• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Kill Sleeping Connections?

 
David Ogasawara
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have a question concerning connection pooling in Tomcat 6. When you close a connection and it is returned to the pool, is it supposed to stay there indefinitely? Is there a timeout that will kill the connection if it is not reused after a few hours?

After running a query, I make sure to close the statement, result set, and connection in a finally statement. However, if I access the database server (SQL Server) I can see the connection still sitting there after over 24 hours. It is "sleeping," but it is still there. My DBA is concerned because our old Java server, JRun, would kill these sleeping connections after a couple of hours of inactivity.

Restarting Tomcat removes all sleeping connections.


Thanks,
Dave
 
Sunil Vasudevan
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you configure connection pools in Tomcat, we have a parameter minIdle. Set this to 0.

The parameter minEvictableIdleTimeMillis is the time the server will wait before closing removing the object which is idle or not in use.

Hope this helps.
 
David Ogasawara
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you!

I'll give it a shot.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic