Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 26865 invoked from network); 18 Sep 2006 02:58:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 18 Sep 2006 02:58:28 -0000 Received: (qmail 82322 invoked by uid 500); 18 Sep 2006 02:58:25 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 82262 invoked by uid 500); 18 Sep 2006 02:58:25 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 82251 invoked by uid 99); 18 Sep 2006 02:58:25 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 17 Sep 2006 19:58:25 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [209.237.227.198] (HELO brutus.apache.org) (209.237.227.198) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 17 Sep 2006 19:58:22 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 216D17142FA for ; Mon, 18 Sep 2006 02:54:26 +0000 (GMT) Message-ID: <9414679.1158548066134.JavaMail.jira@brutus> Date: Sun, 17 Sep 2006 19:54:26 -0700 (PDT) From: "Phil Steitz (JIRA)" To: commons-dev@jakarta.apache.org Subject: [jira] Resolved: (DBCP-116) [dbcp] transactionIsolation, testOnBorrow and autoCommmit=false crashes for Oracle MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/DBCP-116?page=all ] Phil Steitz resolved DBCP-116. ------------------------------ Resolution: Fixed Patch applied. Thanks! > [dbcp] transactionIsolation, testOnBorrow and autoCommmit=false crashes for Oracle > ----------------------------------------------------------------------------------- > > Key: DBCP-116 > URL: http://issues.apache.org/jira/browse/DBCP-116 > Project: Commons Dbcp > Issue Type: Bug > Affects Versions: Nightly Builds > Environment: Operating System: other > Platform: Other > Reporter: Thomas Fischer > Fix For: 1.2.2 > > Attachments: patch_35591.txt, TestSerializableOracleConnection.java, TestSerializableOracleConnection.java > > > I'm using dbcp nightly build 20050626 (i.e. COM-1666 is fixed) to work with a > SharedPoolDataSource with an underlying oracle9i database and the 9.2.0.4 oracle > jdbc driver. > defaultTransactionIsolation is set to 8 (serializable), testOnBorrow is set to > true and defaultAutoCommit is set to false. (as an aside, with the oracle 10g > driver 10.1.0.4 the error also appears for defaultAutoCommit=true, but this is > an oracle problem) > I retrieve a connection, commit it, and close it. The first time works fine. The > second time while retrieving the connection, I get the ORA-01453: SET > TRANSACTION must be first statement of transaction error in the method > SharedPoolDataSource.setupDefaults upon execution of the line 215 : > con.setTransactionIsolation(defaultTransactionIsolation); > I have debugged the pool behaviour, extracted the jdbc commands and am able to > reproduce the behaviour with the following code: > Connection connection = DriverManager.getConnection(sid, user, password); > connection.createStatement().execute("Select 1 from dual"); > connection.setAutoCommit(false); > connection.setTransactionIsolation( > Connection.TRANSACTION_SERIALIZABLE); > //connection.setReadOnly(false); // not needed to get error > connection.commit(); > > connection.createStatement().execute("Select 1 from dual"); > // connection.rollback(); // this would solve the problem > // might be inserted into the validateObject() > // method of KeyedCPDSConnectionFactory > // connection.setAutoCommit(false); // not needed to get error > connection.setTransactionIsolation( > Connection.TRANSACTION_SERIALIZABLE); // this causes the error > I am not sure whether the rollback after the validation query fits into the > general philosophy of dbcp. Before I have come to use dbcp, I had programmed my > own pool and had done a rollback on every connection returned to the pool, in > order not to hand out a connection with a started transaction. In my opinion, > this is a good thing, but one might also argue against it because it eats > performance. > Another solution would be to reverse the validation query / > setTransactionIsolation order, but it seems to me that this is very deep in the > pool architecture. > Still another solution would be to reset autocommit to true when a connection is > returned into the pool, but personally I do not like this solution (it has no > additional merit like the rollback solution). -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org