Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to check whether DB is alive

 
vignesh bala
Greenhorn
Posts: 28
Eclipse IDE Hibernate Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

Please clarify this to me. I have to connect to a DB2 DataBase. I am creating connection object first and using that object to do various transactions. I am creating connection in the constructor of my class.

My problem is,
When my database crashes and immediately recovers to normal state.(I will not know whether DB is crashed). Then I do a query, after this, I am getting the following error:

com.ibm.db2.jcc.a.DisconnectException: A communication error has been detected. Communication protocol being used: T4Agent.sendRequest(). Communication API being used: OutputStream.flush(). Location where the error was detected: Broken pipe. Communication function detecting the error: *. Protocol specific error codes(s) TCP/IP SOCKETS DB2ConnectionCorrelator: AC16011C.DDBE.060910093948. Can anyone suggest how I can rectify it. Or at least is there any way to know that my DB is restarted? Please Help me.
 
Scott Selikoff
author
Saloon Keeper
Posts: 4028
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could put a try/catch block and catch the DisconnectException. From there you can write recovery code.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic