Return-Path: Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 34880 invoked from network); 17 Apr 2003 17:54:36 -0000 Received: from unknown (HELO friedwire.com) (65.103.98.225) by daedalus.apache.org with SMTP; 17 Apr 2003 17:54:36 -0000 Received: from Spooler by friedwire.com (Mercury/32 v3.21c) ID MO00C4EE; 17 Apr 03 11:54:41 -0600 Received: from spooler by friedwire.com (Mercury/32 v3.21c); 17 Apr 03 11:54:30 -0600 Received: from lsteckel (192.168.137.79) by friedwire.com (Mercury/32 v3.21c) with ESMTP ID MG00C4EC; 17 Apr 03 11:54:28 -0600 From: "Linda Steckel" To: "Jakarta Commons Users List" Subject: RE: Lost connection from connection pool Date: Thu, 17 Apr 2003 11:54:27 -0600 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Importance: Normal In-Reply-To: <20030417173406.83349.qmail@web12705.mail.yahoo.com> X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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 > 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