tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antonio Fiol BonnĂ­n <>
Subject Re: Alternatives to DBCP
Date Mon, 23 Jun 2003 18:31:34 GMT

I have not had time to read through your code, but please triple-check 
that you are not double-closing connections.

I suggest you the following: substitute every



connection.close(); connection=null;

If you are double-closing and you have changed all your closes by the 
above, you'll get a nice NullPointerException.

Good luck!

Antonio Fiol

P.S. I had the exact same problem ;-) wrote:

>Has anyone used any alternatives to the DBCP with Tomcat because it seems 
>to get worse and worse as I use it more.  For no apparent reason on one 
>server, if there is a failure of a query to clean up its resources 
>properly then when it it cleaned up by the finalizer method of our query 
>object it actually closes the connection and then DBCP doesnt open any 
>more even though it should, so any connection attempt ends up saying 
>"Connection is closed".  This is obviously a bit of a problem.  I can only 
>assume that the problem lies in the combination of DBCP and my code. 
>Obviously I know that we shouldnt ever use a finalizer to be cleaning 
>stuff up but this is is development so allows us to catch where this 
>occurs in code.  The code for our Query object is included here.
>The cleanUp method works fine normally it seems it is just when called by 
>a finalizer that it goes wrong (although I suppose it could be caused by a 
>SQL Exception in the back end of the system?).  We're using INet 
>Software's Sprinta2000 SQL Server 2000 JDBC driver if that of any 

View raw message