commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Purcell" <spurc...@vertisinc.com>
Subject DBCP package BasicDataSource question
Date Thu, 14 Apr 2005 13:46:50 GMT
Hello,

I finally figured out last night how to obtain a DataSource object in a class, and set enough
properties to get a connection:

BasicDataSource ds = new BasicDataSource();
ds.setDriverClassName("com.mysql.jdbc.Driver");
ds.setUsername("javauser");
ds.setPassword("javadude");
ds.setUrl(connectURI);

then I get a Connection like so:
Connection conn = ds.getConnection()


I am good with all of this, and it works. Now where I am baffled is, where is the pool of
connections. Did this create a pool? I know I had to set the commons-pool.jar in my path to
get it to run. So does this class create a pool in the background? And if so, do I need to
run a thread to shut them down?  I am looking at the BasicDataSource javadocs and I see some
methods like such:

setInitializeSize(int size)
setDefaultAutoCommit(boolean val)
etc.

But I am not sure which ones are for cleaning up "lost" or "dead" connections, etc. And would
this simple configuration work for a simple web application?

Any input would be appreciated.

Thanks,

Scott K Purcell

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message