commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirk Verbeeck <>
Subject Re: DBCP Pooled?
Date Wed, 13 Apr 2005 06:00:36 GMT
BasicDataSource is a thread-safe pooling DataSource.
No extra steps are required. Once you have your datasource you can do 
getConnection/close without extra synchronization and you will get a 
pooled connection.

By the way, can you please write down these questions/answers into the 
wiki (dbcp FAQ). This mailing is the best way for asking questions but 
it would be nice if you can write down your new knowledge into the 
wiki to help other users.

-- Dirk

Scott Purcell wrote:

> Thanks Dirk,
> So now I decided to use the JNDI, and I have a BasicDataSource object in a class. What
are the steps, or what is required (or link) to start using pooled connections?
> Is the BasicDataSource a pool of connections, or just a single connection? How can one
use this from the standpoint of some type of singleton that could hand out connections when
asked for.
> Thanks,
> Scott
> -----Original Message-----
> From: Dirk Verbeeck []
> Sent: Tuesday, April 12, 2005 1:21 AM
> To: Jakarta Commons Users List
> Subject: Re: DBCP Getting started
> JNDI is a naming service, a kind of tree/map between a JNDI name and a 
> service object.
> Tomcat uses the BasicDataSourceFactory to create a BasicDataSource 
> from your configuration settings.
> There is no functional difference between the DBCP datasource tomcat 
> creates or one you would create. Either method works.
> Its a matter of preference. If you use JNDI and deploy your 
> application on lets say a BEA weblogic platform then you would start 
> using their datasource, if you create a BasicDataSource yourself then 
> you always know it is the DBCP implementation.
> -- Dirk
> Scott Purcell wrote:
>>I am having trouble understanding how the DBCP classes work within Tomcat.
>>I have been on the Tomcat site for the past two days, trying to figure things out.
I have been following their example of how to create a the <Context /> and a <Resource
/> and pull those our using JNDI? in order to use obtain a "DataSource".
>>But now after spending some time on the DBCP site, and checking the examples, I do
not see why I need to even use JNDI at all.
>>I am looking at a example here: 
>>And it just shows using the pool without all the JNDI connection, etc.
>>Can someone try and explain to me how this fits together, and why Tomcats example
of using DBCP differs from this sites?

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message