commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Dietrick <>
Subject Re: JNDI Datasource pooling
Date Tue, 07 Jan 2003 01:36:33 GMT
Unless someone sees something glaringly wrong in my original message, 
you can disregard it.  It seems my connection pool was working fine.  My 
load testing program wasn't sending simultaneous requests, so there was 
never any need to create more than one JDBC connection.  It looks to be 
working now.

Robert Dietrick wrote:

> I'm trying to get a MySQL JDBC connection pool configured in Tomcat 
> using JNDI, and I'm having a bit of trouble.
> I followed the instructions at 
> and I seem to have a *single* valid connection to the MySQL database.  
> I was hoping, however, to see multiple connections open to the remote 
> database machine.  When I run 'netstat -n | grep 3306' while Tomcat is 
> under a sustained load, I only see a single JDBC connection.  All of 
> my requests are being handled properly (i.e. the database connection 
> is working), but I'm worried that I'm not getting optimal performance 
> because of the single connection.
> I veered from the instructions referred to above in that I assigned 
> the dataSource (once initialized) to an attribute of a singleton, 
> which I thought would act as the manager for my connection pool.  Is 
> this proper/valid usage?  Or should I do the JNDI lookup every time I 
> need a Connection?
> In other words, may the following code be performed only once (at 
> startup)?  Or should I do it for each request which needs a DB 
> connection?
>       Context ctx = new InitialContext();
>       DataSource ds =        
>     (DataSource)ctx.lookup("java:comp/env/jdbc/TestDB");
> Also, is org.apache.commons.dbcp.BasicDataSourceFactory (from the 
> example) a poolable DataSourceFactory?  Or should I be using something 
> else?
> Thanks.
> -rob
> -- 
> To unsubscribe, e-mail:   
> <>
> For additional commands, e-mail: 
> <>

View raw message