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: DBCP question: what is closing the actual database connection ?
Date Mon, 10 Nov 2003 14:05:27 GMT
The PoolingDriver currently doesn't have a closePool method.
I have made an enhancement request for it
http://issues.apache.org/bugzilla/show_bug.cgi?id=24562
and will commit a fix for it in a few minutes.

In your case (close at program shutdown), the real database driver will probably 
close the connections before the VM shutdown.

-- Dirk

John Zoetebier wrote:

> On Sun, 9 Nov 2003 03:56:15 +0200, Schalk <schalk@volume4.co.za> wrote:
> 
>> John
>>
>> In basic situation you will have:
>> Class.forName(DRIVER);
>> con = DriverManager.getConnection(URL,USER,PASS);
>>
>> At the end you will have:
>> finally {
>>     try {   
>>     if (con != null)
>>         con.close();
>>     } catch (SQLException ex) {
>>             out.println("\nERROR:------ SQLException -----\n");
>>             out.println("Message: " + ex.getMessage());
>>             out.println("SQLState: " + ex.getSQLState());
>>             out.println("ErrorCode :" + ex.getErrorCode());
>>         }
>>             }
>>
> 
> The result of con.close() is that the connection is returned to the 
> connection pool.
> This is the purpose of connection pooling: reuse of a connection to 
> increase performance.
> However at program shutdown something needs to close the "real" 
> connection in the connection pool.
> 
> My question is:
> - is closing of connections in the pool handled automatically by Jakarta 
> Commons DBCP ?
> - or do I have do something manaully to close the connections in the pool ?
> 



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