You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by km...@apache.org on 2009/08/08 17:40:42 UTC

svn commit: r802397 - in /db/derby/code/branches/10.5: ./ java/engine/org/apache/derby/iapi/jdbc/ java/engine/org/apache/derby/jdbc/ java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ java/testing/org/apache/derbyTesting/junit/

Author: kmarsden
Date: Sat Aug  8 15:40:41 2009
New Revision: 802397

URL: http://svn.apache.org/viewvc?rev=802397&view=rev
Log:
DERBY-4310 Closing a prepared statement with an embedded XAConnection can cause the statement to be reprepared and errors related to missing dependencies. This can interfere with network server closeSession()

DERBY-4155 jdbcapi/XATest.java doesn't seem to be running anywhere

Merge from trunk:
svn merge -r 793088:793089 https://svn.apache.org/repos/asf/db/derby/code/trunk
svn merge -r 800522:800523 https://svn.apache.org/repos/asf/db/derby/code/trunk
svn merge -r 794105:794106 https://svn.apache.org/repos/asf/db/derby/code/trunk

Contributed by Tiago R Espinha (tiago at espinhas dot net)


Modified:
    db/derby/code/branches/10.5/   (props changed)
    db/derby/code/branches/10.5/java/engine/org/apache/derby/iapi/jdbc/BrokeredCallableStatement.java
    db/derby/code/branches/10.5/java/engine/org/apache/derby/iapi/jdbc/BrokeredPreparedStatement.java
    db/derby/code/branches/10.5/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatement.java
    db/derby/code/branches/10.5/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatementControl.java
    db/derby/code/branches/10.5/java/engine/org/apache/derby/jdbc/XAStatementControl.java
    db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.java
    db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/_Suite.java
    db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/junit/XATestUtil.java

Propchange: db/derby/code/branches/10.5/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Aug  8 15:40:41 2009
@@ -1 +1 @@
-/db/derby/code/trunk:769596,769602,769606,769962,772090,772337,772449,772534,774281,777105,779681,782991,785131,785139,785163,785570,785662,788369,788670,788674,788968,789264,790218,792434,793588,794955,795166,796020,796027,797147
+/db/derby/code/trunk:769596,769602,769606,769962,772090,772337,772449,772534,774281,777105,779681,782991,785131,785139,785163,785570,785662,788369,788670,788674,788968,789264,790218,792434,793089,793588,794106,794955,795166,796020,796027,797147,800523

Modified: db/derby/code/branches/10.5/java/engine/org/apache/derby/iapi/jdbc/BrokeredCallableStatement.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/engine/org/apache/derby/iapi/jdbc/BrokeredCallableStatement.java?rev=802397&r1=802396&r2=802397&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/engine/org/apache/derby/iapi/jdbc/BrokeredCallableStatement.java (original)
+++ db/derby/code/branches/10.5/java/engine/org/apache/derby/iapi/jdbc/BrokeredCallableStatement.java Sat Aug  8 15:40:41 2009
@@ -60,6 +60,10 @@
         return getCallableStatement().wasNull();
     }
 
+    public final void close() throws SQLException {
+        control.closeRealCallableStatement();
+    }
+    
     public final String getString(int parameterIndex)
         throws SQLException
     {

Modified: db/derby/code/branches/10.5/java/engine/org/apache/derby/iapi/jdbc/BrokeredPreparedStatement.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/engine/org/apache/derby/iapi/jdbc/BrokeredPreparedStatement.java?rev=802397&r1=802396&r2=802397&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/engine/org/apache/derby/iapi/jdbc/BrokeredPreparedStatement.java (original)
+++ db/derby/code/branches/10.5/java/engine/org/apache/derby/iapi/jdbc/BrokeredPreparedStatement.java Sat Aug  8 15:40:41 2009
@@ -73,6 +73,11 @@
         return getPreparedStatement().executeUpdate();
     }
 
+	public void close() throws SQLException
+	{
+	    control.closeRealPreparedStatement();
+	}
+	
     /**
      * Set a parameter to SQL NULL.
      *

Modified: db/derby/code/branches/10.5/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatement.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatement.java?rev=802397&r1=802396&r2=802397&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatement.java (original)
+++ db/derby/code/branches/10.5/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatement.java Sat Aug  8 15:40:41 2009
@@ -125,9 +125,9 @@
      * ResultSet, if one exists, is also closed.
 	 * @exception SQLException thrown on failure.
      */
-	public final void close() throws SQLException
+	public void close() throws SQLException
     {
-		getStatement().close();
+		control.closeRealStatement();
     }
 
     public final Connection getConnection()

Modified: db/derby/code/branches/10.5/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatementControl.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatementControl.java?rev=802397&r1=802396&r2=802397&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatementControl.java (original)
+++ db/derby/code/branches/10.5/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatementControl.java Sat Aug  8 15:40:41 2009
@@ -37,6 +37,26 @@
 	public int checkHoldCursors(int holdability) throws SQLException;
 
 	/**
+	 * Close the real JDBC Statement when this is controlling a Statement.
+	 * @throws SQLException
+	 */
+	public void closeRealStatement() throws SQLException;
+	
+	/**
+	 * Close the real JDBC CallableStatement when this is controlling a
+	 * CallableStatement. 
+	 * @throws SQLException
+	 */
+	public void closeRealCallableStatement() throws SQLException;
+	
+	/**
+	 * Close the real JDBC CallableStatement when this is controlling a
+	 * PreparedStatement. 
+	 * @throws SQLException
+	 */
+	public void closeRealPreparedStatement() throws SQLException;
+	
+	/**
 		Return the real JDBC statement for the brokered statement
 		when this is controlling a Statement.
 	*/

Modified: db/derby/code/branches/10.5/java/engine/org/apache/derby/jdbc/XAStatementControl.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/engine/org/apache/derby/jdbc/XAStatementControl.java?rev=802397&r1=802396&r2=802397&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/engine/org/apache/derby/jdbc/XAStatementControl.java (original)
+++ db/derby/code/branches/10.5/java/engine/org/apache/derby/jdbc/XAStatementControl.java Sat Aug  8 15:40:41 2009
@@ -85,6 +85,27 @@
                 applicationStatement);
 	}
 
+	/**
+	 * Close the realStatement within this control. 
+	 */
+	public void closeRealStatement() throws SQLException {
+		realStatement.close();
+	}
+	
+	/**
+	 * Close the realCallableStatement within this control. 
+	 */
+	public void closeRealCallableStatement() throws SQLException {
+		realCallableStatement.close();
+	}
+	
+	/**
+	 * Close the realPreparedStatement within this control. 
+	 */
+	public void closeRealPreparedStatement() throws SQLException {
+		realPreparedStatement.close();
+	}
+	
 	public Statement getRealStatement() throws SQLException {
 
 		// 

Modified: db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.java?rev=802397&r1=802396&r2=802397&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.java (original)
+++ db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.java Sat Aug  8 15:40:41 2009
@@ -21,6 +21,7 @@
 
 package org.apache.derbyTesting.functionTests.tests.jdbcapi;
 
+import java.sql.CallableStatement;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -167,6 +168,11 @@
      * transaction xa_commit xa_1Phase 3; disconnect; </code>
      */
     public void testInterleavingTransactions() throws SQLException, XAException {
+        Statement preStatement = getConnection().createStatement();
+        preStatement.execute("create table fooInterleaving (a int)");
+        preStatement.execute("insert into fooInterleaving values (0)");
+        preStatement.close();
+        
         XADataSource xads = J2EEDataSource.getXADataSource();
 
         XAConnection xac = xads.getXAConnection("sku", "testxa");
@@ -180,19 +186,19 @@
         Connection conn = xac.getConnection();
 
         Statement s = conn.createStatement();
-        s.executeUpdate("insert into APP.foo values (1)");
+        s.executeUpdate("insert into APP.fooInterleaving values (1)");
         xar.end(xid1, XAResource.TMSUSPEND);
 
         xar.start(xid2, XAResource.TMNOFLAGS);
-        s.executeUpdate("insert into APP.foo values (2)");
+        s.executeUpdate("insert into APP.fooInterleaving values (2)");
         xar.end(xid2, XAResource.TMSUSPEND);
 
         xar.start(xid1, XAResource.TMRESUME);
-        s.executeUpdate("insert into APP.foo values (3)");
+        s.executeUpdate("insert into APP.fooInterleaving values (3)");
         xar.end(xid1, XAResource.TMSUSPEND);
 
         xar.start(xid2, XAResource.TMRESUME);
-        s.executeUpdate("insert into APP.foo values (4)");
+        s.executeUpdate("insert into APP.fooInterleaving values (4)");
 
         String[][] expectedRows = {
                 { "(1", "ACTIVE", "false", "SKU", "UserTransaction" },
@@ -255,7 +261,7 @@
         expectedRows = new String[][] { { "(3", "IDLE", "NULL", "SKU",
                 "UserTransaction" } };
         XATestUtil.checkXATransactionView(conn, expectedRows);
-        ResultSet rs = s.executeQuery("select * from APP.foo");
+        ResultSet rs = s.executeQuery("select * from APP.fooInterleaving");
         expectedRows = new String[][] { { "0" }, { "1" }, { "3" } };
         JDBC.assertFullResultSet(rs, expectedRows);
 
@@ -382,7 +388,15 @@
      * Morph a connection between local anf global transactions.
      */
     public void testMorph() throws SQLException, XAException {
-
+        Statement preStatement = getConnection().createStatement();
+        preStatement.execute("create table fooMorph (a int)");
+        preStatement.executeUpdate("insert into APP.fooMorph values (0)");
+        preStatement.executeUpdate("insert into APP.fooMorph values (1)");
+        preStatement.executeUpdate("insert into APP.fooMorph values (2)");
+        preStatement.executeUpdate("insert into APP.fooMorph values (3)");
+        preStatement.executeUpdate("insert into APP.fooMorph values (4)");
+        preStatement.close();
+        
         XADataSource xads = J2EEDataSource.getXADataSource();
         XAConnection xac = xads.getXAConnection();
 
@@ -397,7 +411,7 @@
          */
         conn.setAutoCommit(false);
         Statement s = conn.createStatement();
-        s.executeUpdate("insert into APP.foo values (2001)");
+        s.executeUpdate("insert into APP.fooMorph values (2001)");
         // no rows expected
         XATestUtil.checkXATransactionView(conn, null);
         conn.commit();
@@ -409,7 +423,7 @@
          */
 
         conn.setAutoCommit(true);
-        s.executeUpdate("insert into APP.foo values (2002)");
+        s.executeUpdate("insert into APP.fooMorph values (2002)");
         XATestUtil.checkXATransactionView(conn, null);
 
         /*
@@ -423,7 +437,7 @@
         String[][] expectedRows = { { "(1", "IDLE", "NULL", "APP",
                 "UserTransaction" } };
         XATestUtil.checkXATransactionView(conn, expectedRows);
-        s.executeUpdate("insert into APP.foo values (2003)");
+        s.executeUpdate("insert into APP.fooMorph values (2003)");
 
         /*
          * -- disallowed commit; -- disallowed rollback; -- disallowed
@@ -462,7 +476,7 @@
         // set, will execute but ResultSet will have close on commit
 
         // DERBY-1158 query with holdable statement
-        s.executeQuery("select * from APP.foo where A >= 2000").close();
+        s.executeQuery("select * from APP.fooMorph where A >= 2000").close();
         s.close();
 
         // statement created in global xact is CLOSE_CURSORS_AT_COMMIT
@@ -473,7 +487,7 @@
         /*
          * select * from foo; xa_end xa_success 1; xa_prepare 1;
          */
-        ResultSet rs = s.executeQuery("select * from APP.foo where A >= 2000");
+        ResultSet rs = s.executeQuery("select * from APP.fooMorph where A >= 2000");
         expectedRows = new String[][] { { "2001" }, { "2002" }, { "2003" } };
 
         rs.close();
@@ -533,12 +547,12 @@
          */
         conn = xac.getConnection();
         s = conn.createStatement();
-        s.executeUpdate("insert into APP.foo values (2005)");
+        s.executeUpdate("insert into APP.fooMorph values (2005)");
         conn.commit();
         conn.setAutoCommit(false);
-        s.executeUpdate("insert into APP.foo values (2006)");
+        s.executeUpdate("insert into APP.fooMorph values (2006)");
         conn.rollback();
-        s.executeUpdate("insert into APP.foo values (2007)");
+        s.executeUpdate("insert into APP.fooMorph values (2007)");
         conn.commit();
 
         expectedRows = new String[][] {
@@ -555,12 +569,12 @@
         xar.rollback(xid2);
 
         XATestUtil.checkXATransactionView(conn, null);
-        rs = s.executeQuery("select * from APP.foo where A >= 2000");
+        rs = s.executeQuery("select * from APP.fooMorph where A >= 2000");
         expectedRows = new String[][] { { "2001" }, { "2002" }, { "2003" },
                 { "2005" }, { "2007" } };
         JDBC.assertFullResultSet(rs, expectedRows);
         rs.close();
-
+        conn.rollback();
         conn.close();
 
         /*
@@ -571,8 +585,8 @@
         conn = xac.getConnection();
         conn.setAutoCommit(false);
         s = conn.createStatement();
-        s.executeUpdate("delete from app.foo");
-        rs = s.executeQuery("select * from APP.foo");
+        s.executeUpdate("delete from app.fooMorph");
+        rs = s.executeQuery("select * from APP.fooMorph");
         JDBC.assertEmpty(rs);
         rs.close();
 
@@ -582,7 +596,7 @@
         conn = xac.getConnection();
         conn.setAutoCommit(false);
         s = conn.createStatement();
-        rs = s.executeQuery("select * from APP.foo where A >= 2000");
+        rs = s.executeQuery("select * from APP.fooMorph where A >= 2000");
         expectedRows = new String[][] { { "2001" }, { "2002" }, { "2003" },
                 { "2005" }, { "2007" } };
         JDBC.assertFullResultSet(rs, expectedRows);
@@ -623,8 +637,8 @@
          * null order by gxid,username; select * from foo;
          */
         s = conn.createStatement();
-        s.executeUpdate("delete from APP.foo");
-        rs = s.executeQuery("select * from APP.foo where A >= 2000");
+        s.executeUpdate("delete from APP.fooMorph");
+        rs = s.executeQuery("select * from APP.fooMorph where A >= 2000");
         JDBC.assertEmpty(rs);
 
         rs.close();
@@ -638,7 +652,7 @@
 
         conn = xac.getConnection();
         s = conn.createStatement();
-        rs = s.executeQuery("select * from APP.foo where A >= 2000");
+        rs = s.executeQuery("select * from APP.fooMorph where A >= 2000");
         expectedRows = new String[][] { { "2001" }, { "2002" }, { "2003" },
                 { "2005" }, { "2007" } };
         JDBC.assertFullResultSet(rs, expectedRows);
@@ -650,10 +664,124 @@
     }
 
     /**
+     * This test checks the fix on DERBY-4310, for not repreparing PreparedStatements
+     * upon calling close() on them.
+     */
+    public void testDerby4310PreparedStatement() throws SQLException, XAException {
+        XADataSource xads = J2EEDataSource.getXADataSource();
+        J2EEDataSource.setBeanProperty(xads, "databaseName", "wombat");
+
+        XAConnection xaconn = xads.getXAConnection();
+       
+        XAResource xar = xaconn.getXAResource();
+        Xid xid = XATestUtil.getXid(1,93,18);
+        
+        /* Create the table and insert some records into it. */
+        Connection conn = xaconn.getConnection();
+        Statement s = conn.createStatement();
+        s.executeUpdate("CREATE TABLE foo4310_PS (I INT)");
+
+        conn.createStatement().executeUpdate("insert into APP.foo4310_PS values (0)");
+        conn.createStatement().executeUpdate("insert into APP.foo4310_PS values (1)");
+        conn.createStatement().executeUpdate("insert into APP.foo4310_PS values (2)");
+        conn.commit();
+        
+        /* Prepare and execute the statement to be tested */
+        PreparedStatement ps = conn.prepareStatement("SELECT * FROM APP.foo4310_PS");
+        ps.executeQuery().close();
+
+        /* Start and end a transaction on the XAResource object */
+        xar.start(xid, XAResource.TMNOFLAGS);
+        xar.end(xid, XAResource.TMSUCCESS);
+        
+        /* Drop the table on a parallel, regular connection */
+        Connection conn2 = getConnection();
+        Statement s2 = conn2.createStatement();
+        s2.execute("DROP TABLE foo4310_PS");
+        conn2.commit();
+        conn2.close();
+        
+        try {
+            /* Try to close the prepared statement. This would throw an exception
+             * before the fix, claiming that the table was not found. */
+            ps.close();
+        } finally {
+            /* Rollback the transaction and close the connections */
+            xar.rollback(xid);
+            conn.close();
+            xaconn.close();
+        }
+        
+    }
+    
+    /**
+     * This test checks the fix on DERBY-4310, for not repreparing CallableStatements
+     * upon calling close() on them.
+     */
+    public void testDerby4310CallableStatement() throws SQLException, XAException {
+        XADataSource xads = J2EEDataSource.getXADataSource();
+        J2EEDataSource.setBeanProperty(xads, "databaseName", "wombat");
+
+        XAConnection xaconn = xads.getXAConnection();
+       
+        XAResource xar = xaconn.getXAResource();
+        Xid xid = XATestUtil.getXid(1,93,18);
+        
+        /* Create the procedure bazed on XATest.zeroArg() */
+        Connection conn = xaconn.getConnection();
+        Statement s = conn.createStatement();
+        s.executeUpdate("CREATE PROCEDURE ZA() LANGUAGE JAVA "+
+                        "EXTERNAL NAME 'org.apache.derbyTesting.functionTests.tests.jdbcapi.XATest.zeroArg' "+
+                        "PARAMETER STYLE JAVA");
+        conn.commit();
+        
+        /* Prepare and execute CallableStatement based on the procedure above */
+        CallableStatement cs = conn.prepareCall("CALL ZA()");
+        cs.execute();
+
+        /* Start and end a transaction on the XAResource object */
+        xar.start(xid, XAResource.TMNOFLAGS);
+        xar.end(xid, XAResource.TMSUCCESS);
+        
+        /* Drop the procedure on a parallel, regular connection */
+        Connection conn2 = getConnection();
+        Statement s2 = conn2.createStatement();
+        s2.execute("DROP PROCEDURE ZA");
+        conn2.commit();
+        conn2.close();
+        
+        try {
+            /* Try to close the prepared statement. This would throw an exception
+             * before the fix, claiming that the table was not found. */
+            cs.close();
+        } finally {
+            /* Rollback the transaction and close the connections */
+            xar.rollback(xid);
+            conn.close();
+            xaconn.close();
+        }
+        
+    }
+    
+    /**
      * Derby-966 holdability and global/location transactions. (work in
      * progress)
      */
     public void testDerby966() throws SQLException, XAException {
+        Statement preStatement = getConnection().createStatement();
+        preStatement.execute("create table foo966 (a int)");
+        preStatement.executeUpdate("insert into APP.foo966 values (0)");
+        preStatement.executeUpdate("insert into APP.foo966 values (1)");
+        preStatement.executeUpdate("insert into APP.foo966 values (2)");
+        preStatement.executeUpdate("insert into APP.foo966 values (3)");
+        preStatement.executeUpdate("insert into APP.foo966 values (4)");
+        preStatement.executeUpdate("insert into APP.foo966 values (2001)");
+        preStatement.executeUpdate("insert into APP.foo966 values (2002)");
+        preStatement.executeUpdate("insert into APP.foo966 values (2003)");
+        preStatement.executeUpdate("insert into APP.foo966 values (2005)");
+        preStatement.executeUpdate("insert into APP.foo966 values (2007)");
+        preStatement.close();
+        
         XADataSource xads = J2EEDataSource.getXADataSource();
         XAConnection xac = xads.getXAConnection();
         XAResource xar = xac.getXAResource();
@@ -670,10 +798,10 @@
         assertEquals(ResultSet.HOLD_CURSORS_OVER_COMMIT, sdh
                 .getResultSetHoldability());
 
-        checkHeldRS(conn, sdh, sdh.executeQuery("select * from app.foo"));
-        PreparedStatement psdh = conn.prepareStatement("SELECT * FROM APP.FOO");
+        checkHeldRS(conn, sdh, sdh.executeQuery("select * from app.foo966"));
+        PreparedStatement psdh = conn.prepareStatement("SELECT * FROM APP.foo966");
         PreparedStatement psdh_d = conn
-                .prepareStatement("DELETE FROM APP.FOO WHERE A < -99");
+                .prepareStatement("DELETE FROM APP.foo966 WHERE A < -99");
         assertEquals(ResultSet.HOLD_CURSORS_OVER_COMMIT, psdh
                 .getResultSetHoldability());
         checkHeldRS(conn, psdh, psdh.executeQuery());
@@ -682,12 +810,12 @@
                 ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT);
         assertEquals(ResultSet.HOLD_CURSORS_OVER_COMMIT, shh
                 .getResultSetHoldability());
-        checkHeldRS(conn, shh, shh.executeQuery("select * from app.foo"));
-        PreparedStatement pshh = conn.prepareStatement("SELECT * FROM APP.FOO",
+        checkHeldRS(conn, shh, shh.executeQuery("select * from app.foo966"));
+        PreparedStatement pshh = conn.prepareStatement("SELECT * FROM APP.foo966",
                 ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY,
                 ResultSet.HOLD_CURSORS_OVER_COMMIT);
         PreparedStatement pshh_d = conn.prepareStatement(
-                "DELETE FROM APP.FOO WHERE A < -99",
+                "DELETE FROM APP.foo966 WHERE A < -99",
                 ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY,
                 ResultSet.HOLD_CURSORS_OVER_COMMIT);
         assertEquals(ResultSet.HOLD_CURSORS_OVER_COMMIT, shh
@@ -699,12 +827,12 @@
         assertEquals(ResultSet.CLOSE_CURSORS_AT_COMMIT, sch
                 .getResultSetHoldability());
 
-        checkHeldRS(conn, sch, sch.executeQuery("select * from app.foo"));
-        PreparedStatement psch = conn.prepareStatement("SELECT * FROM APP.FOO",
+        checkHeldRS(conn, sch, sch.executeQuery("select * from app.foo966"));
+        PreparedStatement psch = conn.prepareStatement("SELECT * FROM APP.foo966",
                 ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY,
                 ResultSet.CLOSE_CURSORS_AT_COMMIT);
         PreparedStatement psch_d = conn.prepareStatement(
-                "DELETE FROM APP.FOO WHERE A < -99",
+                "DELETE FROM APP.foo966 WHERE A < -99",
                 ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY,
                 ResultSet.CLOSE_CURSORS_AT_COMMIT);
         assertEquals(ResultSet.CLOSE_CURSORS_AT_COMMIT, psch_d
@@ -717,10 +845,10 @@
         Statement sdc = conn.createStatement();
         assertEquals(ResultSet.CLOSE_CURSORS_AT_COMMIT, sdc
                 .getResultSetHoldability());
-        checkHeldRS(conn, sdc, sdc.executeQuery("select * from app.foo"));
-        PreparedStatement psdc = conn.prepareStatement("SELECT * FROM APP.FOO");
+        checkHeldRS(conn, sdc, sdc.executeQuery("select * from app.foo966"));
+        PreparedStatement psdc = conn.prepareStatement("SELECT * FROM APP.foo966");
         PreparedStatement psdc_d = conn
-                .prepareStatement("DELETE FROM APP.FOO WHERE A < -99");
+                .prepareStatement("DELETE FROM APP.foo966 WHERE A < -99");
         assertEquals(ResultSet.CLOSE_CURSORS_AT_COMMIT, psdc
                 .getResultSetHoldability());
         checkHeldRS(conn, psdc, psdc.executeQuery());
@@ -729,12 +857,12 @@
                 ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT);
         assertEquals(ResultSet.CLOSE_CURSORS_AT_COMMIT, psdc
                 .getResultSetHoldability());
-        checkHeldRS(conn, shc, shc.executeQuery("select * from app.foo"));
-        PreparedStatement pshc = conn.prepareStatement("SELECT * FROM APP.FOO",
+        checkHeldRS(conn, shc, shc.executeQuery("select * from app.foo966"));
+        PreparedStatement pshc = conn.prepareStatement("SELECT * FROM APP.foo966",
                 ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY,
                 ResultSet.HOLD_CURSORS_OVER_COMMIT);
         PreparedStatement pshc_d = conn.prepareStatement(
-                "DELETE FROM APP.FOO WHERE A < -99",
+                "DELETE FROM APP.foo966 WHERE A < -99",
                 ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY,
                 ResultSet.HOLD_CURSORS_OVER_COMMIT);
         assertEquals(ResultSet.HOLD_CURSORS_OVER_COMMIT, pshc
@@ -746,12 +874,12 @@
                 ResultSet.CONCUR_READ_ONLY, ResultSet.CLOSE_CURSORS_AT_COMMIT);
         assertEquals(ResultSet.CLOSE_CURSORS_AT_COMMIT, scc
                 .getResultSetHoldability());
-        checkHeldRS(conn, scc, scc.executeQuery("select * from app.foo"));
-        PreparedStatement pscc = conn.prepareStatement("SELECT * FROM APP.FOO",
+        checkHeldRS(conn, scc, scc.executeQuery("select * from app.foo966"));
+        PreparedStatement pscc = conn.prepareStatement("SELECT * FROM APP.foo966",
                 ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY,
                 ResultSet.CLOSE_CURSORS_AT_COMMIT);
         PreparedStatement pscc_d = conn.prepareStatement(
-                "DELETE FROM APP.FOO WHERE A < -99",
+                "DELETE FROM APP.foo966 WHERE A < -99",
                 ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY,
                 ResultSet.CLOSE_CURSORS_AT_COMMIT);
         assertEquals(ResultSet.CLOSE_CURSORS_AT_COMMIT, pscc
@@ -762,7 +890,7 @@
         // Revert back to holdable
         conn.setHoldability(ResultSet.HOLD_CURSORS_OVER_COMMIT);
 
-        ResultSet rs = sdh.executeQuery("SELECT * FROM APP.FOO");
+        ResultSet rs = sdh.executeQuery("SELECT * FROM APP.foo966");
         rs.next();
         // before commit
         assertEquals(0, +rs.getInt(1));
@@ -773,7 +901,7 @@
         rs.close();
 
         // ensure a transaction is active to test DERBY-1025
-        rs = sdh.executeQuery("SELECT * FROM APP.FOO");
+        rs = sdh.executeQuery("SELECT * FROM APP.foo966");
 
         // This switch to global is ok because conn
         // is in auto-commit mode, thus the start performs
@@ -783,18 +911,18 @@
         xar.start(xid, XAResource.TMNOFLAGS);
 
         // Statements not returning ResultSet's should be ok
-        sdh.executeUpdate("DELETE FROM APP.FOO where A < -99");
-        shh.executeUpdate("DELETE FROM APP.FOO where A < -99");
-        sch.executeUpdate("DELETE FROM APP.FOO where A < -99");
+        sdh.executeUpdate("DELETE FROM APP.foo966 where A < -99");
+        shh.executeUpdate("DELETE FROM APP.foo966 where A < -99");
+        sch.executeUpdate("DELETE FROM APP.foo966 where A < -99");
 
         ArrayList openRS = new ArrayList();
 
         // Statements obtained while default was hold.
         // All should work, holability will be downgraded
         // to close on commit for those Statements with hold set.
-        openRS.add(sdh.executeQuery("SELECT * FROM APP.FOO"));
-        openRS.add(shh.executeQuery("SELECT * FROM APP.FOO"));
-        openRS.add(sch.executeQuery("SELECT * FROM APP.FOO"));
+        openRS.add(sdh.executeQuery("SELECT * FROM APP.foo966"));
+        openRS.add(shh.executeQuery("SELECT * FROM APP.foo966"));
+        openRS.add(sch.executeQuery("SELECT * FROM APP.foo966"));
 
         // PreparedStatements obtained while default was hold.
         // Holdability should be downgraded.
@@ -808,15 +936,15 @@
         psch_d.executeUpdate();
 
         // Statements not returning ResultSet's should be ok
-        sdc.executeUpdate("DELETE FROM APP.FOO where A < -99");
-        shc.executeUpdate("DELETE FROM APP.FOO where A < -99");
-        scc.executeUpdate("DELETE FROM APP.FOO where A < -99");
+        sdc.executeUpdate("DELETE FROM APP.foo966 where A < -99");
+        shc.executeUpdate("DELETE FROM APP.foo966 where A < -99");
+        scc.executeUpdate("DELETE FROM APP.foo966 where A < -99");
 
         // Statements obtained while default was close.
         // all should return close on commit ResultSets
-        openRS.add(sdc.executeQuery("SELECT * FROM APP.FOO"));
-        openRS.add(shc.executeQuery("SELECT * FROM APP.FOO"));
-        openRS.add(scc.executeQuery("SELECT * FROM APP.FOO"));
+        openRS.add(sdc.executeQuery("SELECT * FROM APP.foo966"));
+        openRS.add(shc.executeQuery("SELECT * FROM APP.foo966"));
+        openRS.add(scc.executeQuery("SELECT * FROM APP.foo966"));
 
         // PreparedStatements obtained while default was close.
         openRS.add(psdc.executeQuery());
@@ -863,7 +991,7 @@
         // DERBY2481 Client does not downgrade PreparedStatement holdability
         if (!usingDerbyNetClient()) {
             PreparedStatement psglobalhold = conn.prepareStatement(
-                    "SELECT * FROM APP.FOO", ResultSet.TYPE_FORWARD_ONLY,
+                    "SELECT * FROM APP.foo966", ResultSet.TYPE_FORWARD_ONLY,
                     ResultSet.CONCUR_READ_ONLY,
                     ResultSet.HOLD_CURSORS_OVER_COMMIT);
             assertEquals(ResultSet.CLOSE_CURSORS_AT_COMMIT, psglobalhold
@@ -991,6 +1119,11 @@
         rs.close();
         conn.commit();
     }
+    
+    /** 
+     * Dummy method for testDerby4310* fixtures
+     */
+    public static void zeroArg() {  }
 
     public static Test baseSuite(String name) {
         TestSuite suite = new TestSuite(name);
@@ -1018,6 +1151,7 @@
         // no XA for JSR169
         if (JDBC.vmSupportsJSR169())
             return suite;
+
         suite.addTest(baseSuite("XATest:embedded"));
 
         suite.addTest(TestConfiguration

Modified: db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/_Suite.java?rev=802397&r1=802396&r2=802397&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/_Suite.java (original)
+++ db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/_Suite.java Sat Aug  8 15:40:41 2009
@@ -88,7 +88,7 @@
         suite.addTest(RelativeTest.suite());
         suite.addTest(metadataMultiConnTest.suite());
         suite.addTest(ResultSetStreamTest.suite());
-        suite.addTest(InternationalConnectSimpleDSTest.suite());
+        suite.addTest(InternationalConnectSimpleDSTest.suite());       
         
         // Old harness .java tests that run using the HarnessJavaTest
         // adapter and continue to use a single master file.
@@ -117,7 +117,8 @@
             suite.addTest(PoolXADSCreateShutdownDBTest.suite());
             suite.addTest(XADSAuthenticationTest.suite());
             suite.addTest(XATransactionTest.suite());
-
+            suite.addTest(XATest.suite());
+            
             // Test uses JDBC 3.0 datasources, and javax.naming.Reference etc.
             suite.addTest(DataSourceReferenceTest.suite());
             suite.addTest(DataSourceSerializationTest.suite());

Modified: db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/junit/XATestUtil.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/junit/XATestUtil.java?rev=802397&r1=802396&r2=802397&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/junit/XATestUtil.java (original)
+++ db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/junit/XATestUtil.java Sat Aug  8 15:40:41 2009
@@ -79,7 +79,7 @@
         if (expectedRows == null)
             JDBC.assertEmpty(rs);
         else
-            JDBC.assertFullResultSet(rs, expectedRows);
+            JDBC.assertUnorderedResultSet(rs, expectedRows);
         rs.close();
     }