Testing database connection Using Javascript in outbound database connector in Mirth
I have database handle in channelMap (for 1 connection for all messages) and I reuse the connection for all messages. Now, b开发者_如何学Goefore 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.
精彩评论