Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 64133 invoked from network); 26 Aug 2004 08:22:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 26 Aug 2004 08:22:39 -0000 Received: (qmail 9318 invoked by uid 500); 26 Aug 2004 08:22:14 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 9188 invoked by uid 500); 26 Aug 2004 08:22:11 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 9142 invoked by uid 99); 26 Aug 2004 08:22:10 -0000 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=FROM_NO_LOWER X-Spam-Check-By: apache.org Received: from [193.16.173.122] (HELO dns2new.din.de) (193.16.173.122) by apache.org (qpsmtpd/0.27.1) with ESMTP; Thu, 26 Aug 2004 01:22:08 -0700 Received: from DOM2DIN-MTA by NWBLN013.ORGDV.DIN.DE with Novell_GroupWise; Thu, 26 Aug 2004 10:21:59 +0200 Message-Id: X-Mailer: Novell GroupWise Internet Agent 6.0.4 Date: Thu, 26 Aug 2004 10:21:47 +0200 From: "PANTA-RHEI WOLF" To: Subject: [DBCP] using dbcp in struts throws sometimes a NoSuchElementException / SQLNestedException Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Virus-Scanned: by amavisd-new at din.de X-Virus-Scanned: by amavisd-new at din.de X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Hi there, i have a very strange behaviour using DBCP. I have a small set = of JSPs talking to an oracledatabase. after a while it looks if my application hang. 2 till 3 minutes later it seems to work = fine again. When i have a look in my logfile, i can see the following exception. I do not know what happen exactly, can anyone = help me please? Another question, i check always if the resultset/statement and connection = is available and then i close the connection. Is it correct closing it after use? Below is the Exception, the datasource-config and a snippet from my = application. Thank you in advance Mirko The Exception is the following: 04/08/24 15:51:59 org.apache.commons.dbcp.SQLNestedException: Cannot get a = connection, pool exhausted 04/08/24 15:51:59 at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingD= ataSource.java:103) 04/08/24 15:51:59=20 at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataS= ource.java:540) 04/08/24 15:51:59 at de.orb.quick.model.CommunicationLayer.executeStatement(Communica= tionLayer.java:86) 04/08/24 15:51:59 at de.orb.quick.model.TreeDataBean.getResult(TreeDataBean.java:57) = 04/08/24 15:51:59=20 .... at org.apache.commons.dbcp.AbandonedObjectPool.borrowObject(Abandon= edObjectPool.java:74) 04/08/24 15:51:59=20 at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingD= ataSource.java:95) 04/08/24 15:51:59 ... 62 more=20 The datasource Configuration in struts-config.xml: the application snippet:=20 // ----------------------------------------------------------------- public ArrayList getResult( ... ) { ArrayList data =3D new ArrayList(); ResultSet rset =3D null; int counter =3D 0; =20 try { rset =3D executeStatement( "my sql statement" ); if(rset !=3D null){ while( rset.next() ) { =20 .. do something with the result } } } catch (Exception ex) { ex.printStackTrace(); } finally { try { if (rset!=3D null && rset.getStatement() !=3D null && rset.getState= ment().getConnection() !=3D null) { // Close resultset & statements rset.getStatement().getConnection().close(); } } catch (Exception ignored) { } } return data; } // ----------------------------------------------------------------- public ResultSet executeStatement( List parameter ) { ResultSet rset =3D null; CallableStatement cstmt =3D null; try { =20 Connection connection =3D dataSource.getConnection(); String dbBuffer =3D new StringBuffer( parameter.get(0).toString() = ); if (connection !=3D null) { cstmt =3D connection.prepareCall( dbBuffer ); rset =3D cstmt.executeQuery(); } } catch (SQLException ex) { ex.printStackTrace(); }=20 return rset; } Mit freundlichen Gr=FC=DFen Mirko Wolf ---------------------------------------------------------------------------= -------------------------------------------------------------- panta rhei systems gmbh budapester stra=DFe 31 10787 berlin tel +49.30.26 01-14 17 fax +49.30.26 01-414 13 wolf@panta-rhei.de=20 www.panta-rhei.de=20 Diese Nachricht ist vertraulich und ausschliesslich f=FCr den Adressaten = bestimmt. Jeder Gebrauch durch Dritte ist verboten. Falls Sie die Daten = irrtuemlich erhalten haben, nehmen Sie bitte Kontakt mit dem Absender auf = und loeschen Sie die Daten auf jedem Computer und Datentraeger. Der = Absender ist nicht verantwortlich f=FCr die ordnungsgemaesse, vollstaendige= oder verzoegerungsfreie =DCbertragung dieser Nachricht. This message is confidential and intended solely for the use by the = addressee. Any use of this message by a third party is prohibited. If you = received this message in error, please contact the sender and delete the = data from any computer and data carrier. The sender is neither liable for = the proper and complete transmission of the information in the message nor = for any delay in its receipt. --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org