stmtB.execute("INSERT INTO test VALUES(2)");
stmtB.execute("INSERT INTO xa_test VALUES(2)");
    public void testXAConnection() throws Exception {        XADataSource xads = (XADataSource) pool;        try {            XAConnection xaConA = xads.getXAConnection();            XAConnection xaConB = xads.getXAConnection();            XAResource xaResA = xaConA.getXAResource();            XAResource xaResB = xaConB.getXAResource();            Xid xidA = new FBTestXid();            Xid xidB = new FBTestXid(xidA.getGlobalTransactionId());            xaResA.start(xidA, XAResource.TMNOFLAGS);            xaResB.start(xidB, XAResource.TMNOFLAGS);            Connection conA = xaConA.getConnection();            try {                Connection conB = xaConB.getConnection();                try {                    Statement stmtA = conA.createStatement();                    try {                        stmtA.execute("INSERT INTO test VALUES(1)");                    } finally {                        stmtA.close();                    }                    Statement stmtB = conB.createStatement();                    try {                        stmtB.execute("INSERT INTO test VALUES(2)");                    } finally {                        stmtB.close();                    }                } finally {                    conB.close();                }            } finally {                conA.close();            }            xaResA.end(xidA, XAResource.TMSUCCESS);            xaResB.end(xidB, XAResource.TMSUCCESS);            xaResA.prepare(xidA);            xaResB.prepare(xidB);            xaResA.commit(xidA, false);            xaResB.commit(xidB, false);            Connection conC = pool.getPooledConnection().getConnection();            try {                Statement stmtC = conC.createStatement();                try {                    ResultSet rs = stmtC                            .executeQuery("SELECT a FROM test ORDER BY a");                    assertTrue("Should select at least one row.", rs.next());                    assertTrue("First value should be 1", rs.getInt(1) == 1);                    assertTrue("Should select at least two rows.", rs.next());                    assertTrue("Second value should be 2 but is " + rs.getInt(1), rs.getInt(1) == 2);                    assertTrue("Should select only two rows.", !rs.next());                } finally {                    stmtC.close();                }            } finally {                conC.close();            }        } catch (Exception ex) {            ex.printStackTrace();            throw ex;        } finally {            pool.shutdown();        }    }