• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to force abandoned JDBC connections to close?  RSS feed

 
Tammy Schluender
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We are trying to convince a vendor that they have a memory leak related to DB connections not being closed. In the meantime, I'm trying to find a way to force close abandoned connections.

I know there are attributes on the resource definition for removeAbandoned and removeAbandonedTimeout, but the vendor must be defining the connection pool within their code because I can't find the resource definition in any of the ususal XML files. All I can find is a JDBC url in a properties file.

Is there a way to apply the removeAbandoned and removeAbandonedTimeout attributes globally? I'm working with Tomcat 6 and Java 6.
 
K. Tsang
Bartender
Posts: 3648
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is better to close them in coding.

Have a look at http://www.coderanch.com/t/621152/JDBC/databases/Proper-closing-jdbc-connection-result to see what is the proper way.

When using connection pool, I believe the unclosed connections will eventually become idle and go back to the pool. This makes the max pool size very important - once reached, no more new connections can be created.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!