commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Tonhofer, m-plify S.A." <>
Subject Re: Resource cleanup in DBCP
Date Tue, 02 Nov 2004 09:01:38 GMT
Here's a guess on the design rationale:

I makes sense to me that the pooling function does just that - transparent
pooling of resources, i.e. you code should not change when you replace a
"non-pooling" Connection creation with a "pooling" Connection creation -
or vice-versa. Thus you still have to do all the cleanup yourself. This,
however, is not hard to do. I am not using DbUtils but have only three
methods that do all the try/catch.

-- David

--On Monday, November 01, 2004 10:58 AM -0800 Alik Eliashberg <>

> Hello,
> Does DBCP close the connection related resources (e.g. PreparedStatements) on the return
to the pool? From a cursory look at the source code, it looks like it only closes the connection-related
resources if the connection is closed and removed from the pool - not when the user code just
calls Connection.close(), thereby returning the connection to the available pool.
> If that is by design, then why? It seems that it would place an extra onerous on user
code to be peppered with 'try/finally' clauses to catch all hanging Statements... [The problem
is partially solved by using DbUtils, which has the 'try/finally' blocks, but why not let
DBCP cleanup these resources? Is there a meaningful case where the connection is returned
to the pool, but the Statement
> should not be closed?]
> TIA,
> Alik
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

-- David Tonhofer

   Resp. Informatique
   47, av. de la Liberté
   L-1931 Luxembourg
   Tel: +352 261846-52
   Fax: +352 261846-46
   Mob: +352 021-139031

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message