wood burning stoves 2.0*
The moose likes JDBC and the fly likes Recognizing stale connections in connection pool Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Recognizing stale connections in connection pool" Watch "Recognizing stale connections in connection pool" New topic
Author

Recognizing stale connections in connection pool

Steve Tharp
Greenhorn

Joined: Mar 19, 2001
Posts: 10
Does anyone know the best way to identify stale connections in a connection pool? Our application resides on a webfarm and connects to a DB2 database on an OS/390 mainframe using DB2Connect. The problem is the database is set to break connections after 10 minutes but the database does not notify DB2Connect when a connection has timed out and therefore my connection pool class still thinks the connection is available thus causing errors when a servlet grabs a stale connection.
What is the best way for the connectionpool class to determine if the connection is still valid? (I've tried connection.isClosed() and this does not work) Would getMetaData be an option? Or what about a simple query to test it? Any help is greatly appreciated!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Recognizing stale connections in connection pool