commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Keith Veleba <>
Subject [DBCP] sample usage questions
Date Thu, 29 May 2003 19:57:19 GMT

I'm currently in the process of retrofitting an application that  
contains some database connection pooling.  Unfortunately, scalability  
issues with the current custom pooling implementation have cropped up,  
forcing a rewrite of those pools.  In my search, I discovered the DBCP  
and decided to use it to implement more robust pools in our application.

However, I have a question that I'm hoping someone can answer.

1)  My application calls for a number of pools to be created to  
different databases.  I would like to know how best to use the objects  
provided. Currently, our pooling is implemented using the Singleton  
design pattern; I would like to create a version of that class which  
uses the DBCP for pooling, and not our homegrown pooling code.
In the manual pooling example shown, the pool consists of the following  

ObjectPool connectionPool = new GenericObjectPool(null);
ConnectionFactory connectionFactory = new  
PoolableConnectionFactory poolableConnectionFactory = new  
PoolingDriver driver = new PoolingDriver();

I would assume from this example that for any number of pools,  I would  
need instances of the following:

1 ObjectPool, ConnectionFactory, and PoolableConnectionFactory for each  
database connection pool
1 PoolingDriver for all connection pools.

Is this essentially correct?

Keith Veleba

View raw message