commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Steitz <p...@steitz.com>
Subject Re: How does DBCP determine to reuse a connection?
Date Sat, 12 Jul 2008 16:05:47 GMT
Neil Aggarwal wrote:
> Hello:
>
> I am writing a JDBC driver that encapsulates the
> MySQL driver and adds some custom logging and functionality.
>
> When I use DBCP with my driver, it is not reusing connections.
> When I use DBCP with the MySQL driver, it is reusing the
> connections.
>
> I need to figure out is how DBCP determines it is
> going to reuse the connections to ensure my code complies
> with its expectations.
>
> Is there a document that covers this?
>   
All DBCP documentation is either in the javadoc or on the website.
http://commons.apache.org/dbcp/
You might find the sequence diagrams useful
http://commons.apache.org/dbcp/guide/sequencediagrams.html

DBCP maintains a pool of objects that wrap physical database connections 
created using a PoolableConnectionFactory.  PoolableConnectionFactory 
uses a DBCP's DriverManagerConnectionFactory or DriverConnectionFactory 
to invoke DriverManger.getConnection or driver.connect, resp. 

If there are idle connections available in the pool, DBCP will try to 
reuse them.  If testOnBorrow is set to true, connections are validated 
before being returned to clients and if validation fails, they are 
destroyed.  There are also configuration options to close abandoned 
connections or connections that have been idle in the pool beyond a 
configurable idle timeout.  These options can also prevent connections 
from being reused.

How have you configured DBCP and how are you testing? 

Phil
> Thanks,
> 	Neil
>
> --
> Neil Aggarwal, (832)245-7314, www.JAMMConsulting.com
> Eliminate junk email and reclaim your inbox.
> Visit http://www.spammilter.com for details. 
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message