commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rob" <unknown-ri...@earthlink.net>
Subject RE: Question on using commons classes for connection pooling
Date Sat, 20 Mar 2004 15:50:16 GMT

Hi Dirk,

Thanks!  That helps - in fact it's working great.  Is it possible to set the
pool on the fly?  When I try to get the configurable connectionPool object
like so ...

	GenericObjectPool connectionPool = driver.getPool("3gs-user-pool");

I get

	java:151: incompatible types

Even if I don't configure it on they fly, I'd like to get more information
on the pool statistics.

This has been very helpful, but the way.  Do you mind if I ask if you work
for apache, or are you with an independant company and you just monitory the
email list?  It's really great to have this resource.  I thought I might
even answer a question for someone else but several people had already done
it.

Regards,

Rob


-----Original Message-----
From: Dirk Verbeeck [mailto:dirk.verbeeck@pandora.be]
Sent: Friday, March 19, 2004 1:24 PM
To: Jakarta Commons Users List
Subject: Re: Question on using commons classes for connection pooling


Hi Rob
see comments inline

Rob wrote:
> Hi All,
>
> I'm using the commons connection pooling classes for connection pooling
for
> a web site I'm working on.  I don't have apache/tomcat as the web server
yet
> ( sorry - converting soon! )  - for now I'm using Sun One, but I'm using
the
> connection pool example from the apache web site
>
>
http://cvs.apache.org/viewcvs.cgi/*checkout*/jakarta-commons/dbcp/doc/Manual
> PoolingDriverExample.java
>
> I've got it connecting to MySQL fine, but I can't figure out how to set
the
> minimum and maximum connections?

You set it on the connectionPool but you have to use the concrete
implementation. In the example:

GenericObjectPool connectionPool = new GenericObjectPool(null);
connectionPool.setMaxActive(maximum);

See the GenericObjectPool for more info:
http://jakarta.apache.org/commons/pool/apidocs/org/apache/commons/pool/impl/
GenericObjectPool.html

Also, when I get connection pool info
>
>         ObjectPool connectionPool = driver.getPool("example");
>
> I'm reminded that the getPool method is deprecated.  How do I get the pool
> to look at it?

In DBCP v1.1 you the only way  is to use the deprecated method.
(it will not be removed any time soon but be careful it throws
RuntimeExceptions)
In the nightly builds of DBCP you can use the getConnectionPool method.
http://issues.apache.org/bugzilla/show_bug.cgi?id=25067

> Also, being a total newbie to open source projects, is this the best forum
> for these questions?

Yes, the user mailing list is created for these questions/answers.

-- Dirk



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


---------------------------------------------------------------------
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