commons-user mailing list archives

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

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

ObjectPool connectionPool = new GenericObjectPool(null);
ConnectionFactory connectionFactory = new  
DriverManagerConnectionFactory(connectURI,null);
PoolableConnectionFactory poolableConnectionFactory = new  
PoolableConnectionFactory(connectionFactory,connectionPool,null,null,fal 
se,true);
PoolingDriver driver = new PoolingDriver();
driver.registerPool("example",connectionPool);

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?

Thanks,
Keith Veleba
<keith@veleba.net>


Mime
View raw message