Testing database connection Using Javascript in outbound database connector in Mirth
-
26-09-2019 - |
문제
I have database handle in channelMap (for 1 connection for all messages) and I reuse the connection for all messages. Now, before performing inserts (to a MySQL database), I want to test if the connection still exists. How do I perform this test?
해결책
A crude way is to grab the connection and run a simple query (a simple SELECT or SHOW query would do) and catch the exception.
I think this is all based on JTDS, so you should be able to use Connection.closed which will return true if the connection is closed and false if it is open.
제휴하지 않습니다 StackOverflow