commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirk Verbeeck <>
Subject Re: DBCP general setup and use
Date Fri, 03 Oct 2003 19:53:10 GMT
see inline

Daryl Stultz wrote:

>"Jakarta Commons Users List" <> writes:
>>Hi Daryl,
>Thanks for the references.
>>Constructing your own datasource can be a bit tricky, take a look at 
>>BasicDataSource as example
>Really? I based mine on the examples and it seems to work just fine (with
>the exception of the class loading in the case of SQLServer). How do I use
ok, not so tricky it seems, I just pointed to BasicDataSource because 
that is the one Tomcat uses. It is a sort of reference implementation.
But building your own is also nice

>>A few pointers about your current code:
>>The properties you give to the DriverManagerConnectionFactory are the 
>>properties for your database driver.
>>In your case only "user" & "password".
>You mean the others I set are ignored?
All the properties are given to java.sql.DriverManager.getConnection but 
yes they are probably ignored.

>>The driver itself should be loaded by a Class.forName(driver); as you 
>>would do without a pool.
>You mean I did it right? Shouldn't the driver factory do that for me?
It is not a driver factory but a connection factory using the 
java.sql.DriverManager and the java.sql.DriverManager requires a 

>>Mapping of your old configuration:
>>* max connections - the maximum number of connections allowed out
>>=> connectionPool maxActive
>>* min connections - the number of connections to open upon start up
>>=> minIdle   (not only at startup but always) (needs 
>>timeBetweenEvictionRunsMillis configuration)
>>* max checkout - the number of seconds a connection is allowed out of 
>>the pool
>>=> AbandonedConfig removeAbandonedTimeout
>>* connection reset time - a possibly DbConnectionBroker-specific recycle 
>>time (defaults to one day)
>>=> connectionPool minEvictableIdleTimeMillis (needs 
>>timeBetweenEvictionRunsMillis configuration)
>I've got the 1.1 RC and AbandondedConfig is deprecated (what is the
The feature will probably remain in future releases but the 
implementation may be refactored if needed.
But it is safe to use.

>Can you give me some reasonable values for the above (other than min and
>max connections since this is application dependant...)?
Set removeAbandonedTimeout only if you have a connection leak in your 
application/dependant libs.
It should be higher then the longest time you use a connection.
minEvictableIdleTimeMillis is for network/database environment where 
connections are being closed by a firewall/database when they are idle 
for too long.
It is really dependent on the environment.

>I see that I can set a logWriter but how do I configure it? It doesn't
>seem to be logging anything.
Logging is a weak point, currently nothing is logged to the logWriter.


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

View raw message