EmbeddedXADataSource dscsx = new EmbeddedXADataSource();
dscsx.setDatabaseName("c:/dellater/db1");
XADataSource dsx = dscsx;
XAConnection xac = dsx.getXAConnection();
con = xac.getConnection
();
s = con.createStatement();
System.out.println("default isolation level should be CS? " + con.getTransactionIsolation());
dumpRS(s.executeQuery("VALUES CURRENT ISOLATION"));
System.out.println
("change the isolation level with setTransactionIsolation");
con.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
System.out.println("new isolation level should be UR? " + con.getTransactionIsolation
());
dumpRS(s.executeQuery("VALUES CURRENT ISOLATION"));
XAResource xar = xac.getXAResource();
Xid xid = new cdsXid(1, (byte) 35, (byte) 47);
xar.start(xid, XAResource.TMNOFLAGS);
s = con.createStatement();
System.out.println("isolation level inside global transaction is " + con.getTransactionIsolation());
dumpRS(s.executeQuery("VALUES CURRENT ISOLATION"));
System.out.println("change the isolation level inside global transaction with setTransactionIsolation");
con.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
System.out.println("new isolation level should be RS? " +
con.getTransactionIsolation());
dumpRS(s.executeQuery("VALUES CURRENT ISOLATION"));
xar.end(xid, XAResource.TMSUCCESS);
xar.rollback(xid);
System.out.println("isolation level outside global transaction should be UR? " + con.getTransactionIsolation());
dumpRS(s.executeQuery("VALUES CURRENT ISOLATION"));
