commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mark archur <>
Subject Re: [dbcp] usage of BasicDataSource
Date Mon, 20 Jun 2005 15:06:16 GMT
Hi Dirk/All,
Thanks for the information on BasicDataSource. Its good to know that BasicDataSource can give
me all I want. Though, I do not seem to run out of questions yet related to dbcp:).......
Regarding setting parameters via setter methods: I defined these settings in my server.xml
and the code seems to be picking up/honoring these settings. Are setter methods of BasicDataSource
not another way of setting parameters to the pool? What is the right way and/or the usual
way of setting these parameters? via server.xml? or via setter methods of BasicDataSource?
Similarly, regarding setting connectionProprties to the driver, there is a parameter "connectionParameters"
which can be defined in server.xml ans can be used to set different driver proprties. Do we
still have to do this via BasicDataSource.setConnectionProperties() method?
I read at few places (eg: dbcp tool java doc) that *abandoned* is deprepcated and will be
removed from the future releases. Is this deprecation valid/true only for BasicDataSource.*Abandoned*()
methods? or is it valid even with setting *abandoned* parameters in server.xml? finally, is
it not advisable to use *abandoned* related stuff now when usinf commons-dbcp-1.1 version?
Thanks in advance for the answers.

Dirk Verbeeck <> wrote:
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:

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message