I have expanded upon the work James House did to generate stack traces for abandoned db connections. (Thanks James)
The patch he provided was refactored and some new features added. Three new DBCP parameters were added: removeAbandoned - True or false. If true abandoned db connections are removed after the removeAbandonedTimout is exceeded if the dbcp is nearing exhaustion. removeAbandonedTimeout - Time in seconds since a connection was last used before it is considered abandoned. logAbandoned - True or false. If true Exception stack traces are created so that the source of an abandoned db connection can be logged. While reviewing the code I noticed that Statements and ResultSets were not being closed when a Connection was closed (recycled). This behaviour differs from the JDBC spec which states that the underlying Statements and ResultSets should be closed when a Connection is closed. This patch tracks Statements and ResultSets so that when the Connection which created them is closed they are closed also. This patch should be backward compatible with any code which uses the existing DBCP. I also have a patch to the Tomcat 4 DbcpDataSourceFactory.java so that it can use these new features. I have been running Tomcat 4.1 with this new DBCP code on a production system with 10-20k DBCP uses per day for the last three days and it has worked well. For me, this patch is critical for a production system. It ensures that Tomcat and the DBCP can recover from buggy applications which sometimes fail to return a db connection to the pool. In addition it can point the finger at the buggy application which failed to return a connection to the pool. I can post the patch to the list, or if someone wants to grant me karma for jakarta-commons I can just commit it to CVS. Regards, Glenn ---------------------------------------------------------------------- Glenn Nielsen [EMAIL PROTECTED] | /* Spelin donut madder | MOREnet System Programming | * if iz ina coment. | Missouri Research and Education Network | */ | ---------------------------------------------------------------------- -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>