Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Best way to Check Database connection is alive or not

843859Jun 16 2006 — edited Oct 15 2007
HI,
I have java program in which i use some connection with Database.
Before using connection i want to check that Database connection is valid mean , Still connection is alive or not (due to some network failure)
and if its not connected i will try to refresh/reconnect my connection in my progam and after refreshing i will use that connection .

To check that connection is alive i run connectioin.comit() on my connection object.
What is best method to ping or check that connection is valid other then commit(). or this commit() operation is good.
i want some light weight operation by which i know connection is available.
Any good suggestion for auto healing.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 12 2007
Added on Jun 16 2006
14 comments
9,172 views