commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Linda Steckel" <Li...@FriedWire.com>
Subject RE: Lost connection from connection pool
Date Thu, 17 Apr 2003 17:54:27 GMT
I believe that better logging would really help solve a lot of problems.
However, it's been my experience that DBCP works well in some circumstances
but there are problems with connections being lost when DBCP is under load.
I've read every message in this user group and there are many others with
having this exact problem and some point to threading issues.  I believe
that my configuration is correct.  In fact, we have one product where DBCP
works well enough for production and another where connections are lost too
much.  We abide by all recommendations in these threads and in the
documentation and we don't have this problem with the same code running on a
Weblogic server.  We are trying to move away from Weblogic to Tomcat so if
anyone has specific recommendations for other pooling software's that works
with Oracle 8i and Tomcat 4.1, please let me know.  Or if there's a newer
release of DBCP on it's way, it would be nice to know that as well.

Linda

-----Original Message-----
From: Jason Pettiss [mailto:jpettiss@yahoo.com]
Sent: Thursday, April 17, 2003 11:34 AM
To: Jakarta Commons Users List
Subject: RE: Lost connection from connection pool


If you go and read the code you'll see there's nothing complicated about
DBCP
itself at all... it's a very thin delegation layer, nothing more.

The complex part is the configuration of the darned thing, which is
undocumented, and relies on either programmatic configuration (yuck) or JOCL
(blech).

I'm using the datasource from Tomcat, and when it works, it works.  Of
course
when it doesn't work, it's always a configuration problem, and the errors
returned from DBCP are misleading and unhelpful.

Better documentation, MUCH BETTER LOGGING!, and some thought put forth to
actually think about usage of the thing (i.e. configuration and
configuration
problems) are very much in order.

But from what I've seen, once you get the configuration right, it really
does
work like a charm.

--jason

--- travis@spaceprogram.com wrote:
> This is really strange.  It turns out I'm not the only person having big
> problems with DBCP, but yet so many people rely on it and it seems to be
> probably one of the weakest connection pooling systems.  Connection
pooling
> is relatively simple, yet I think DBCP has made it far too complicated and
> therefore, lots of errors.  I wonder about all the people that are using
the
> datasource in Tomcat?
>
> I don't think DBCP should be released as a stable version after seeing all
> these errors on this list lately.
>
> Travis
>
> ---- Original Message ----
> From: Doss Markus <Markus.Doss@rhein-zeitung.net>
> Sent: 2003-04-17
> To: commons-user@jakarta.apache.org
> Subject: Lost connection from connection pool
>
> I'm using tomcat with a connection pool (setup as datasource) using the
> following code :
>
> private void setupDriver () {
>   String contentURI = buildConnectionURL();
>   try {
>     Class.forName(this.driverName);
>     ObjectPool connectionPool = new GenericObjectPool(null);
>     ConnectionFactory connectionFactory = new
> DriverManagerConnectionFactory(contentURI,null);
>
> GenericKeyedObjectPoolFactory opf = new
> GenericKeyedObjectPoolFactory(null, 10,
> GenericKeyedObjectPool.WHEN_EXHAUSTED_BLOCK, 2000L, 10, true, true,
> 10000L, 5, 5000L, true);
>
> PoolableConnectionFactory poolableConnectionFactory = new
> PoolableConnectionFactory(connectionFactory,connectionPool,opf,null,fals
> e,true);
>       PoolingDriver driver = new PoolingDriver();
>
>       driver.registerPool("myPool",connectionPool);
>    } catch (Exception e) {
>      e.printStackTrace();
>    }
> }
>
> Database properties comes within a file. While tomcat startup I load a
> servlet, so that I have access to this pool. I'm using a lot of
> webservices which connect to a mySQL database. For example like these :
>
>    query = "select ObjectKey from rw_object where ObjectName = '" +
> objectName + "'";
>    logger.debug(query);
>
>    con = DriverManager.getConnection("jdbc:apache:commons:dbcp:myPool");
>
>    stmt = con.createStatement();
>
>    rs = stmt.executeQuery(query);
>    while (rs.next()) {
>      objectKey = rs.getString(1);
>      count++;
>    }
>
>    rs.close();
>    stmt.close();
>    con.close();
>
> Sometimes this service failes, because the getConnection from the pool
> fails. Theres thrown an exception like this
>
> java.lang.NullPointerException
>         at com.mysql.jdbc.Connection.execSQL(Unknown Source)
>         at com.mysql.jdbc.Connection.execSQL(Unknown Source)
>         at com.mysql.jdbc.Connection.setAutoCommit(Unknown Source)
>         at
> org.apache.commons.dbcp.DelegatingConnection.setAutoCommit(DelegatingCon
> nection.java)
>         at
> org.apache.commons.dbcp.DelegatingConnection.setAutoCommit(DelegatingCon
> nection.java)
>         at
> org.apache.commons.dbcp.PoolableConnectionFactory.activateObject(Poolabl
> eConnectionFactory.java)
>         at
> org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjec
> tPool.java)
>         at
> org.apache.commons.dbcp.PoolingDriver.connect(PoolingDriver.java)
>         at java.sql.DriverManager.getConnection(DriverManager.java:512)
>         at java.sql.DriverManager.getConnection(DriverManager.java:193)
>         at
> redweb.common.soap.service.RWObjectService.getObjectKey(RWObjectService.
> java:87)
>
>
> What's wrong with my pool or my handling with the connections. I tried
> also to close the connection a the finally clause after the exception
> was thrown. But this doesn't work either properly.
>
> Has anyone ideas ?
>
> Thanks in advance and best regargs
>
> Markus
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>


__________________________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo
http://search.yahoo.com

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