Return-Path: Delivered-To: apmail-db-torque-dev-archive@www.apache.org Received: (qmail 39967 invoked from network); 10 Aug 2010 19:33:41 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 10 Aug 2010 19:33:41 -0000 Received: (qmail 29943 invoked by uid 500); 10 Aug 2010 19:33:41 -0000 Delivered-To: apmail-db-torque-dev-archive@db.apache.org Received: (qmail 29891 invoked by uid 500); 10 Aug 2010 19:33:41 -0000 Mailing-List: contact torque-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Apache Torque Developers List" Reply-To: "Apache Torque Developers List" Delivered-To: mailing list torque-dev@db.apache.org Received: (qmail 29883 invoked by uid 99); 10 Aug 2010 19:33:41 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Aug 2010 19:33:41 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Aug 2010 19:33:38 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o7AJXGfD000257 for ; Tue, 10 Aug 2010 19:33:17 GMT Message-ID: <156848.260401281468796946.JavaMail.jira@thor> Date: Tue, 10 Aug 2010 15:33:16 -0400 (EDT) From: "Thomas Fischer (JIRA)" To: torque-dev@db.apache.org Subject: [jira] Commented: (TORQUE-123) Statement is left open when Exception is thrown in the QueryDataSet constructor (ORA-01000) In-Reply-To: <1927138765.1256030759371.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/TORQUE-123?page=3Dcom.atlassian= .jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1289= 7014#action_12897014 ]=20 Thomas Fischer commented on TORQUE-123: --------------------------------------- I'm going to use another patch: boolean ok =3D false; try { stmt =3D conn.createStatement(); resultSet =3D stmt.executeQuery(selectStmt); schema =3D new Schema(); schema.populate(resultSet.getMetaData(), null); ok =3D true; }=20 finally { if (!ok) { try { close(); } catch (Exception ignored) { // ignore as another exception is already thrown } } } If anyone disagrees please state why > Statement is left open when Exception is thrown in the QueryDataSet cons= tructor (ORA-01000) > -------------------------------------------------------------------------= -------------------- > > Key: TORQUE-123 > URL: https://issues.apache.org/jira/browse/TORQUE-123 > Project: Torque > Issue Type: Bug > Components: Village > Affects Versions: 3.3 > Environment: OS =EF=BC=9ARedHat Enterprise Linux ES 4 update 4 > Java =EF=BC=9A1.4.2_08 > Tomcat=EF=BC=9A4.1.31 > Torque=EF=BC=9A3.0.2 > JDBC(Oracle): ojdbc.jar(10.2.0.4) > Reporter: Kazu Nambo > Assignee: Thomas Fischer > Fix For: 3.3.1 > > > When syntax error(SQLException) happens at executeQuery in the constructo= r QueryDataSet(Connection conn, String selectStmt), the member stmt is left= open and this problem sometimes results in ORA-01000 (Maximum open cursors= exceeded). > In the upper layer like BasePeer#executeQuery method, it tries to close Q= ueryDataSet instance by VillageUtils.close but it fails because the instanc= e is null. > Other exceptions may result in the same situation. > If I try to make the constructor more robust as follows, it will work. (N= o ORA-01000) > public QueryDataSet(Connection conn, String selectStmt) > throws SQLException, DataSetException > { > this.conn =3D conn; > selectString =3D new StringBuffer(selectStmt); > try=20 > { > =09stmt =3D conn.createStatement(); > =09resultSet =3D stmt.executeQuery(selectStmt); > =09schema =3D new Schema(); > =09schema.populate(resultSet.getMetaData(), null); > } > catch (Exception e) > { > =09try { > =09=09if (null !=3D resultSet) { > =09=09=09resultSet.close(); > =09=09} > =09} catch (Exception ignored) {} > =09try { > =09=09if (null !=3D stmt) { > =09=09=09stmt.close(); > =09=09} > =09} catch (Exception ignored) {} > =09if (e instanceof SQLException) > =09=09throw (SQLException)e; > =09else if (e instanceof DataSetException) > =09=09throw (DataSetException)e; > =09else > =09=09throw new SQLException("QueryDataSet: exception caught.", e= ); > } > } --=20 This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org For additional commands, e-mail: torque-dev-help@db.apache.org