Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 5915 invoked from network); 8 Feb 2006 04:14:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 8 Feb 2006 04:14:24 -0000 Received: (qmail 72706 invoked by uid 500); 8 Feb 2006 04:14:24 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 72677 invoked by uid 500); 8 Feb 2006 04:14:23 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 72668 invoked by uid 99); 8 Feb 2006 04:14:23 -0000 X-ASF-Spam-Status: No, hits=1.3 required=10.0 tests=SPF_FAIL X-Spam-Check-By: apache.org Received: from [192.87.106.226] (HELO ajax.apache.org) (192.87.106.226) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Feb 2006 20:14:23 -0800 Received: from ajax.apache.org (ajax.apache.org [127.0.0.1]) by ajax.apache.org (Postfix) with ESMTP id 28499CB for ; Wed, 8 Feb 2006 05:14:02 +0100 (CET) Message-ID: <819412545.1139372042162.JavaMail.jira@ajax.apache.org> Date: Wed, 8 Feb 2006 05:14:02 +0100 (CET) From: "Kathey Marsden (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Commented: (DERBY-898) setAutoCommit(false) is not working properly for local transaction with ClientXADataSource In-Reply-To: <1690251660.1138738593498.JavaMail.jira@ajax.apache.org> 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/DERBY-898?page=comments#action_12365518 ] Kathey Marsden commented on DERBY-898: -------------------------------------- OK. So I decided to go with option 1), but wonder what the naming convention should be for this. Right now I have simpleSavepointJdbc30.java for the base test that runs with all jvms and extendedSavepointJdbc30.java for the one that has the non J2ME/CDC/FP functionality, but would there be a better naming convention? > setAutoCommit(false) is not working properly for local transaction with ClientXADataSource > ------------------------------------------------------------------------------------------ > > Key: DERBY-898 > URL: http://issues.apache.org/jira/browse/DERBY-898 > Project: Derby > Type: Bug > Components: Network Server > Versions: 10.1.1.0, 10.1.1.1 > Reporter: Kathey Marsden > Assignee: Kathey Marsden > Priority: Critical > Fix For: 10.2.0.0, 10.1.3.0, 10.1.2.3 > Attachments: DERBY-898.diff > > Network Server is not honoring local > transaction rollback using ClientXADataSource. Run the following standalone JDBC code. > The output shows that after rolling back the local transaction, > the inserted data is still present. > final org.apache.derby.jdbc.ClientXADataSource ds = > new org.apache.derby.jdbc.ClientXADataSource(); > ds.setServerName("localhost"); > ds.setPortNumber(1527); > > ds.setDatabaseName("WOMBAT"); > ds.setTraceLevel(-1); > > ds.setSecurityMechanism(ds.CLEAR_TEXT_PASSWORD_SECURITY); > ds.setUser("dbuser1"); > ds.setPassword("dbpwd1"); > //ds.setLogWriter(new > java.io.PrintWriter(System.out)); > XAConnection xaConn = ds.getXAConnection(); > Connection conn = xaConn.getConnection(); > > conn.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_R > EAD); > conn.setAutoCommit(true); > System.out.println("Database product: " + > conn.getMetaData().getDatabaseProductName()); > System.out.println("Database version: " + > conn.getMetaData().getDatabaseProductVersion()); > System.out.println("Driver name: " + > conn.getMetaData().getDriverName()); > System.out.println("Driver version: " + > conn.getMetaData().getDriverVersion()); > Statement stmt = conn.createStatement(); > try { stmt.execute("drop table cmtest"); } > catch (SQLException sqlX) {} // ok, didn't exist > stmt.execute("CREATE TABLE cmtest (id integer not null > primary key, name varchar(60))"); > stmt.close(); > conn.setAutoCommit(false); > PreparedStatement pstmt = conn.prepareStatement( > "INSERT INTO cmtest (id, name) VALUES(?,?)", > ResultSet.TYPE_FORWARD_ONLY, > ResultSet.CONCUR_READ_ONLY); > pstmt.setInt(1, 13); > pstmt.setString(2, "blah1"); > pstmt.executeUpdate(); > pstmt.setInt(1, 2); > pstmt.setString(2, "blah2"); > pstmt.executeUpdate(); > conn.rollback(); > PreparedStatement pstmt2 = conn.prepareStatement( > "SELECT * FROM cmtest WHERE id = ?", > ResultSet.TYPE_FORWARD_ONLY, > ResultSet.CONCUR_READ_ONLY); > pstmt2.setInt(1, 13); > ResultSet rset = pstmt2.executeQuery(); > if (rset.next()) > { > System.out.println("Test fails. First insert was > not rolled back."); > System.out.println("The data is still present. It > is: " + rset.getObject(1) + > ", " + rset.getObject(2)); > } > else > System.out.println("Test passes. First insert was > rolled back."); > Here's the output, > Database product: Apache Derby > Database version: 10.1.2.2 > Driver name: Apache Derby Network Client JDBC Driver > Driver version: 10.1.2.2 > Test fails. First insert was not rolled back. > The data is still present. It is: 13, blah1 > On some brief investigation I see that the Network Server embedded connection is in autocomit mode so is autocommitting the transaction before the rollback. Network server should always have autocommit false and let the client drive the commit. -- 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