Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 79732 invoked from network); 3 Aug 2009 20:10:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 3 Aug 2009 20:10:21 -0000 Received: (qmail 711 invoked by uid 500); 3 Aug 2009 20:10:26 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 656 invoked by uid 500); 3 Aug 2009 20:10:26 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 647 invoked by uid 99); 3 Aug 2009 20:10:26 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Aug 2009 20:10:26 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Aug 2009 20:10:20 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 8F385238886D; Mon, 3 Aug 2009 20:09:59 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r800523 - in /db/derby/code/trunk/java: engine/org/apache/derby/iapi/jdbc/ engine/org/apache/derby/jdbc/ testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ Date: Mon, 03 Aug 2009 20:09:59 -0000 To: derby-commits@db.apache.org From: kmarsden@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090803200959.8F385238886D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: kmarsden Date: Mon Aug 3 20:09:58 2009 New Revision: 800523 URL: http://svn.apache.org/viewvc?rev=800523&view=rev Log: DERBY-4310 jdbcapi.XATest passes but shows Table/View 'APP.FOO' does not exist. under logs/serverConsoleOutput.log DERBY-4155 jdbcapi/XATest.java doesn't seem to be running anywhere The problem was actually an embedded issue that close() tried to reprepare the statement which would fail if dependencies had been dropped. This caused a failur in proper shutdown of network server which could cause a hang after running XATest. Contributed by Tiago Espinha (tiago at espinhas dot net) Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredCallableStatement.java db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredPreparedStatement.java db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatement.java db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatementControl.java db/derby/code/trunk/java/engine/org/apache/derby/jdbc/XAStatementControl.java db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.java db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/_Suite.java Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredCallableStatement.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredCallableStatement.java?rev=800523&r1=800522&r2=800523&view=diff ============================================================================== --- db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredCallableStatement.java (original) +++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredCallableStatement.java Mon Aug 3 20:09:58 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/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredPreparedStatement.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredPreparedStatement.java?rev=800523&r1=800522&r2=800523&view=diff ============================================================================== --- db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredPreparedStatement.java (original) +++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredPreparedStatement.java Mon Aug 3 20:09:58 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/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatement.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatement.java?rev=800523&r1=800522&r2=800523&view=diff ============================================================================== --- db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatement.java (original) +++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatement.java Mon Aug 3 20:09:58 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/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatementControl.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatementControl.java?rev=800523&r1=800522&r2=800523&view=diff ============================================================================== --- db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatementControl.java (original) +++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatementControl.java Mon Aug 3 20:09:58 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/trunk/java/engine/org/apache/derby/jdbc/XAStatementControl.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/jdbc/XAStatementControl.java?rev=800523&r1=800522&r2=800523&view=diff ============================================================================== --- db/derby/code/trunk/java/engine/org/apache/derby/jdbc/XAStatementControl.java (original) +++ db/derby/code/trunk/java/engine/org/apache/derby/jdbc/XAStatementControl.java Mon Aug 3 20:09:58 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/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.java?rev=800523&r1=800522&r2=800523&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.java (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.java Mon Aug 3 20:09:58 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; */ 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,7 +569,7 @@ 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); @@ -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/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/_Suite.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/_Suite.java?rev=800523&r1=800522&r2=800523&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/_Suite.java (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/_Suite.java Mon Aug 3 20:09:58 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());