commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirk Verbeeck <>
Subject Re: [dbcp] usage of BasicDataSource
Date Sat, 18 Jun 2005 11:15:47 GMT
Hi Mark,

mark archur wrote:
> Hi,
> I configured the dbcp properly and I tested with my prototype and is working fine. what
is the purpose of BasicDataSource? How is it different from normal DataSource? Can't I achieve
PreparedStatement pooling when I use DataSource? 

BasicDataSource is an implementation of the Datasource interface. It 
support a preparedstatement pooling and other nice features.
If you only use the methods defined in the Datasource interface then you 
can replace the dbcp datasource by another implementation so it is a 
best practice to use the dbcp methods only when creating the pool and 
use the datasource interface in your application code.

> If I want to use BasicDataSource, do we have to set all the settings programatically
using setUsername, setPassword, setMaxIdle, setMaxIdle, etc?
The are defaults for most properties. You have of you course set some of 
them (username/password, url, ...).
You can also use:
ds = BasicDataSourceFactory.createDataSource(Properties properties);
and configure the pool using a property file.

> Thanks for the answers in advance.


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

View raw message