This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes Stale Database Connections Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Stale Database Connections" Watch "Stale Database Connections" New topic

Stale Database Connections

Kash Mhai

Joined: Apr 01, 2005
Posts: 29
I use WAS 5.X and use connection pooling for obtaining database connections. However i get "connection closed" exception, and i traced it back to the stale connections in the pool. How do i identify from java code or any other means that a connection has become stale and obtain a new connection?

Any help is appreciated,


-------------<br />There are wheels within wheels...<br />P.G Wodehouse
Serkan Demir
Ranch Hand

Joined: Feb 03, 2005
Posts: 61
a common solution for this pooling problem is to run a pinger thread to send keep alive query (e.g: select 1 from anytable)to all connections in the pool with a constant frequency. By the way, connections wouldn't be stale anymore.

A guy from Turkey<br /><a href="" target="_blank" rel="nofollow"></a>
I agree. Here's the link:
subject: Stale Database Connections
It's not a secret anymore!