Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 2224 invoked from network); 16 Aug 2005 23:32:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 16 Aug 2005 23:32:08 -0000 Received: (qmail 97524 invoked by uid 500); 16 Aug 2005 23:32:05 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 97235 invoked by uid 500); 16 Aug 2005 23:32:03 -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: "Derby Development" Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 96968 invoked by uid 99); 16 Aug 2005 23:32:01 -0000 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=SPF_FAIL,UPPERCASE_25_50 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, 16 Aug 2005 16:31:58 -0700 Received: from ajax.apache.org (ajax.apache.org [127.0.0.1]) by ajax.apache.org (Postfix) with ESMTP id 7F19DE3 for ; Wed, 17 Aug 2005 01:31:57 +0200 (CEST) Message-ID: <810828878.1124235117519.JavaMail.jira@ajax.apache.org> Date: Wed, 17 Aug 2005 01:31:57 +0200 (CEST) From: "Mike Matrigali (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Updated: (DERBY-421) starting an XA transaction resets the isolation level set with SET CURRENT ISOLATION In-Reply-To: <888305673.1120172578396.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-421?page=all ] Mike Matrigali updated DERBY-421: --------------------------------- Component: JDBC > starting an XA transaction resets the isolation level set with SET CURRENT ISOLATION > ------------------------------------------------------------------------------------ > > Key: DERBY-421 > URL: http://issues.apache.org/jira/browse/DERBY-421 > Project: Derby > Type: Sub-task > Components: JDBC > Reporter: Kathey Marsden > > When an XA Transaction is started the isolation level set with SET CURRENT ISOLATION gets reset to CS. > Embedded setTransactionIsolation does not have this problem but this problem is the root cause of DERBY-414 because client implements setTransactionIsolation by sending SET CURRENT ISOLATION > $ java TestSetCurrentIsolation > Database product: Apache Derby > Database version: 10.2.0.0 alpha > Driver name: Apache Derby Embedded JDBC Driver > Driver version: 10.2.0.0 alpha > SET CURRENT ISOLATION = UR > CURRENT ISOLATION: UR > getTransactionIsolation:TRANSACTION_READ_UNCOMMITTED:1 > Isolation level after xa start > CURRENT ISOLATION: CS > getTransactionIsolation:TRANSACTION_READ_COMMITTED:2 > $ > import java.sql.*; > import javax.sql.*; > import javax.transaction.xa.*; > public class TestSetCurrentIsolation > { > public static void main(String[] args) throws Throwable > { > try > { > final org.apache.derby.jdbc.EmbeddedXADataSource ds = > new org.apache.derby.jdbc.EmbeddedXADataSource(); > ds.setDatabaseName("C:\\drivers\\derby\\databases\\SCHEDDB"); > ds.setUser("dbuser1"); > ds.setPassword("******"); > XAConnection xaConn = ds.getXAConnection(); > Connection conn = xaConn.getConnection(); > 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(); > System.out.println("SET CURRENT ISOLATION = UR"); > stmt.executeUpdate("SET CURRENT ISOLATION = UR"); > showIsolationLevel(conn); > conn.setAutoCommit(false); > XAResource xaRes = xaConn.getXAResource(); > Xid xid = new TestXid(1,(byte) 32, (byte) 32); > xaRes.start(xid, XAResource.TMNOFLAGS); > System.out.println("Isolation level after xa start"); > showIsolationLevel(conn); > > xaRes.end(xid, XAResource.TMSUCCESS); > xaRes.rollback(xid); > conn.close(); > xaConn.close(); > } > catch (SQLException sqlX) > { > System.out.println("Error on thread 1."); > do sqlX.printStackTrace(); > while ((sqlX = sqlX.getNextException()) != null); > } > catch (Throwable th) > { > System.out.println("Error on thread 1."); > do th.printStackTrace(); > while ((th = th.getCause()) != null); > } > } > /** > * @param conn > * @throws SQLException > */ > private static void showIsolationLevel(Connection conn) throws SQLException { > PreparedStatement ps = conn.prepareStatement("VALUES CURRENT ISOLATION"); > ResultSet rs = ps.executeQuery(); > //ResultSet rs = conn.createStatement().executeQuery("VALUES CURRENT ISOLATION"); > rs.next(); > System.out.println("CURRENT ISOLATION: " + rs.getString(1)); > System.out.println("getTransactionIsolation:" + > getIsoLevelName(conn.getTransactionIsolation())); > } > > public static String getIsoLevelName(int level) > { > switch (level) { > case java.sql.Connection.TRANSACTION_REPEATABLE_READ: > return "TRANSACTION_REAPEATABLE_READ:" + level; > > case java.sql.Connection.TRANSACTION_READ_COMMITTED: > return "TRANSACTION_READ_COMMITTED:" + level; > case java.sql.Connection.TRANSACTION_SERIALIZABLE: > return "TRANSACTION_SERIALIZABLE:" + level; > case java.sql.Connection.TRANSACTION_READ_UNCOMMITTED: > return "TRANSACTION_READ_UNCOMMITTED:" + level; > } > return "UNEXPECTED_ISO_LEVEL"; > } > } -- 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