Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Recognizing stale connections in connection pool  RSS feed

Steve Tharp
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!