commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirk Verbeeck <dirk.verbe...@pandora.be>
Subject Re: JNDI datasource returning *closed* DBCP connections
Date Sun, 10 Aug 2003 13:17:02 GMT
Hi Daniel

Your example didn't make it. Can you resend it or attach it to the 
bugzilla entry:
http://issues.apache.org/bugzilla/show_bug.cgi?id=22079

Regards
Dirk


Daniel Bray (CAPE) wrote:

>If I accidentally close DBCP connections twice, it will eventually cause the
>JNDI datasource to start returning connections that are already closed.
>
>Essentially my problem is this:
>
>while (true)
>{
>  DataSource ds = getDataSourceFromJNDI();
>  Connection conn = ds.getConnection();
>  PreparedStatement ps = conn.prepareStatement("SELECT * FROM ......");
>  ResultSet rs = ps.executeQuery();
>
>  rs.close();
>  ps.close();
>  conn.close();
>
>  // make the mistake of closing it twice
>  conn.close();
>}
>
>Eventually getDataSourceFromJNDI() returns me a connection that's already
>closed. In fact both it, and it's delegate, have the same object reference
>IDs as the connections returned by the previous call.
>
>This only happens if I use the connection to do something, and not if I just
>create it and then close it.
>
>
>I can always just wrap the connection in a proxy and then just not forward
>on the close call if it's already been closed, but I figure that someone out
>there might want to fix this properly and I can't find where I'm supposed to
>commit bugs.
>
>
>
>
>
>This sort of problem is best described in code, so I'm attaching it below.
>It's a simple enough servlet that exposes this problem.
>
>
>
>from me, daniel.
>
>  
>
>------------------------------------------------------------------------
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>




Mime
View raw message