Category Archives: tomcat

Detecting connection leaks with tomcat connection pool

Tomcat’s JDBC connection pool can help you detect connection leaks in your web application. It provides the below three attributes in order to do this


(boolean) Flag to remove abandoned connections if they exceed the removeAbandonedTimout. If set to true a connection is considered abandoned and eligible for removal if it has been in use longer than the removeAbandonedTimeout Setting this to true can recover db connections from applications that fail to close a connection. See also logAbandoned The default value is false.
removeAbandonedTimeout (int) Timeout in seconds before an abandoned(in use) connection can be removed. The default value is 60 seconds. The value should be set to the longest running query your applications might have.
logAbandoned (boolean) Flag to log stack traces for application code which abandoned a Connection. Logging of abandoned Connections adds overhead for every Connection borrow because a stack trace has to be generated. The default value is false.