commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Zoetebier <john.zoeteb...@transparent.co.nz>
Subject Re: When does dbcp close a connection?
Date Wed, 26 Nov 2003 20:30:12 GMT
On Wed, 26 Nov 2003 17:34:05 +0100, Zsolt Koppany 
<zkoppanylist@intland.com> wrote:

> Hi,
>
> I have looked into the dbcp sources and getConnection just returns a
> java.sql.Connection object. Does that mean that connection.close closes 
> the
> connection to the database? If not, when will be the connection really
> closed?

Connection.close will return the connection to the pool.
After setting up DBCP yout code can basically stay the same.
To close the real connection to the database at application shutdown do:
connectionPool.close();

This will closed the actual connections to the databse.
I made a wrapper class for setting up DBCP and closing the connection pool.

-- 
John Zoetebier
Web site: http://www.transparent.co.nz

---------------------------------------------------------------------
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