Friday, November 11, 2011

Invalid connection handle or connection is closed

If you get below mentioned error

Exception in thread "main" COM.ibm.db2.jdbc.DB2Exception: [IBM][JDBC Driver] CLI0600E  Invalid connection handle or connection is closed. SQLSTATE=S1000
    at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throwConnectionClosedError(Unknown Source)
    at COM.ibm.db2.jdbc.app.DB2ResultSet.checkHandlesAndIndex(Unknown Source)
    at COM.ibm.db2.jdbc.app.DB2ResultSet.next(Unknown Source)
    at com.hewitt.hre.util.Test.main(Test.java:19)

Possible reason could be you have closed the connection and trying to use Element like ResutSet. Please check the flow of your program again. Connection must be closed only after use of ResutSet.

Make sure  Connection and other resource are made free after use of all resource.