[ February 01, 2006: Message edited by: Reid M. Pinchback ]
But on the other database (DB2) I am not able to find such information. I thought isClosed() will throw an exception if its a stale connection.
And yes you are right. I should really look into the Database driver documenation for an error code that relates to stale connection.
Originally posted by Babji Reddy:
I thought isClosed() will throw an exception if its a stale connection.
No, isClosed() API documentation is clear and specific; isClosed() is only required to return true when Connection.close() has been called, and may 9or may not) return and Exception for a stale connection. The Javadocs say:
This method generally cannot be called to determine whether a connection to a database is valid or invalid. A typical client can determine that a connection is invalid by catching any exceptions that might be thrown when an operation is attempted.
"an operation" above is some other JDBC operation, such as attempting to prepare a statement.