• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Kill Sleeping Connections?

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you!

I'll give it a shot.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic