Return-Path: Delivered-To: apmail-commons-issues-archive@locus.apache.org Received: (qmail 33157 invoked from network); 20 Aug 2007 11:21:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 Aug 2007 11:21:54 -0000 Received: (qmail 45035 invoked by uid 500); 20 Aug 2007 11:21:50 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 44960 invoked by uid 500); 20 Aug 2007 11:21:49 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 44951 invoked by uid 99); 20 Aug 2007 11:21:49 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Aug 2007 04:21:49 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Aug 2007 11:21:51 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 8CF3A714211 for ; Mon, 20 Aug 2007 04:21:30 -0700 (PDT) Message-ID: <6854219.1187608890572.JavaMail.jira@brutus> Date: Mon, 20 Aug 2007 04:21:30 -0700 (PDT) From: "Oliver Matz (JIRA)" To: issues@commons.apache.org Subject: [jira] Created: (DBCP-237) InstanceKeyDataSource.getConnection, exception during setup Defaults() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org InstanceKeyDataSource.getConnection, exception during setup Defaults() ---------------------------------------------------------------------- Key: DBCP-237 URL: https://issues.apache.org/jira/browse/DBCP-237 Project: Commons Dbcp Issue Type: Bug Affects Versions: 1.2.1 Environment: Sybase jConnect2 5.5, spring framework 2.0.1 Reporter: Oliver Matz Problem in org.apache.commons.dbcp.datasources.InstanceKeyDataSource.getConnection(String username, String password) if setupDefaults() throws an Exception, the connection will not get closed. After a while, this will cause the following exception: org.apache.commons.dbcp.SQLNestedException: Could not retrieve connection info from pool This scenario can happen for Sybase jConnect2 5.5. The exception that may be thrown by jConnect2 is: com.sybase.jdbc2.jdbc.SybConnectionDeadException: JZ0C0: Connection is already closed. More details: The last lines of the method are as follows: ------- Connection con = info.getPooledConnection().getConnection(); setupDefaults(con, username); con.clearWarnings(); return con; ------- In my case, the exception happens in the second line of this snippet, so no code gets the chance close con and release the resources. I propose to change it to: ------- Connection con = info.getPooledConnection().getConnection(); try { setupDefaults(con, username); con.clearWarnings(); return con; } catch (Exception exc) { try { con.close(); } catch (Exception exc) { getLogWriter().println("ignoring exception during close: " + exc); // uncertain here. } throw exc; } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.