开发者

Testing database connection Using Javascript in outbound database connector in Mirth

开发者 https://www.devze.com 2022-12-29 23:58 出处:网络
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 tes

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号