Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 59550 invoked from network); 22 Mar 2007 20:51:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 22 Mar 2007 20:51:10 -0000 Received: (qmail 11247 invoked by uid 500); 22 Mar 2007 20:51:18 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 11212 invoked by uid 500); 22 Mar 2007 20:51:18 -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 11201 invoked by uid 99); 22 Mar 2007 20:51:18 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Mar 2007 13:51:18 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Mar 2007 13:51:09 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 04DEA1A9838; Thu, 22 Mar 2007 13:50:49 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r521453 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests: master/ master/DerbyNetClient/ suites/ tests/lang/ Date: Thu, 22 Mar 2007 20:50:48 -0000 To: derby-commits@db.apache.org From: kmarsden@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070322205049.04DEA1A9838@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: kmarsden Date: Thu Mar 22 13:50:47 2007 New Revision: 521453 URL: http://svn.apache.org/viewvc?view=rev&rev=521453 Log: DERBY-2422 convert lang/holdCursorJava.java to junit. Contributed by Manjula Kutty Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/HoldCursorTest.java (with props) Removed: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/holdCursorJava.out db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/holdCursorJava.out db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/holdCursorJava.java db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/holdCursorJava_app.properties Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNet.exclude db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbylang.runall db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/embeddedUseprocess.exclude db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/j9derbynetmats.runall db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/jdk14.runall db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNet.exclude URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNet.exclude?view=diff&rev=521453&r1=521452&r2=521453 ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNet.exclude (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNet.exclude Thu Mar 22 13:50:47 2007 @@ -6,7 +6,6 @@ # excluding jdbcapi/rsgetXXXcolumnNames.java as it fails incorrectly, according to JDBC spec. Forwarding test case to JCC team. # excluding jdbcapi/checkDataSource30.java - Client behaves differently. Need to look into this # excluding jdbcapi/statementJdbc30.java - Client behaves differently. Need to look into this -# excluding jdbcapi/holdCursorJava.java - JCC behaves differently with hold cursors. # excluding jdbcapi/dataSourceReference.java - client side only tests, tests all data sources # regardless of framework # excluding largedata/LobLimits.java to run with the network server because currently lobs are materialized and this test tests for 2G lobs. @@ -21,7 +20,6 @@ jdbcapi/blobSetBinaryStream.java jdbcapi/checkDataSource30.java jdbcapi/statementJdbc30.java -lang/holdCursorJava.java jdbcapi/dataSourceReference.java #no XA for JCC jdbcapi/savepointJdbc30_XA.java Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbylang.runall URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbylang.runall?view=diff&rev=521453&r1=521452&r2=521453 ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbylang.runall (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbylang.runall Thu Mar 22 13:50:47 2007 @@ -37,7 +37,6 @@ lang/grantRevokeDDL.sql lang/grantRevokeDDL2.sql lang/holdCursorIJ.sql -lang/holdCursorJavaReflection.java lang/inbetween.sql lang/infostreams.sql lang/isolationLevels.sql Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall?view=diff&rev=521453&r1=521452&r2=521453 ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall Thu Mar 22 13:50:47 2007 @@ -22,7 +22,6 @@ lang/bug5054.java lang/forupdate.sql lang/holdCursorIJ.sql -lang/holdCursorJavaReflection.java lang/procedure.java lang/simpleScroll.sql lang/supersimple.sql Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/embeddedUseprocess.exclude URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/embeddedUseprocess.exclude?view=diff&rev=521453&r1=521452&r2=521453 ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/embeddedUseprocess.exclude (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/embeddedUseprocess.exclude Thu Mar 22 13:50:47 2007 @@ -7,7 +7,6 @@ # and access denied (java.lang.RuntimePermission loadLibrary.db2jcct2). (????!) # jdbcapi/getCurConnJdbc20.sql ditto. # jdbcapi/checkDataSource30.java problem using reflection (class not found) -# lang/holdCursorJava.java ditto. # lang/procedureJdbc30.java ditto. # jdbcapi/SURQueryMixTest.junit - fails with severe errors. # jdbcapi/SURTest.junit - fails with severe errors. @@ -18,7 +17,6 @@ jdbcapi/bestrowidentifier.sql jdbcapi/getCurConnJdbc20.sql jdbcapi/checkDataSource30.java -lang/holdCursorJava.java lang/procedureJdbc30.java jdbcapi/SURQueryMixTest.junit jdbcapi/SURTest.junit Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/j9derbynetmats.runall URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/j9derbynetmats.runall?view=diff&rev=521453&r1=521452&r2=521453 ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/j9derbynetmats.runall (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/j9derbynetmats.runall Thu Mar 22 13:50:47 2007 @@ -16,7 +16,6 @@ lang/bug5054.java lang/forupdate.sql lang/holdCursorIJ.sql -lang/holdCursorJavaReflection.java lang/procedure.java lang/simpleScroll.sql lang/supersimple.sql Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/jdk14.runall URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/jdk14.runall?view=diff&rev=521453&r1=521452&r2=521453 ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/jdk14.runall (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/jdk14.runall Thu Mar 22 13:50:47 2007 @@ -1,4 +1,3 @@ -lang/holdCursorJava.java jdbcapi/checkDataSource30.java jdbcapi/parameterMetaDataJdbc30.java lang/procedureJdbc30.java Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/HoldCursorTest.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/HoldCursorTest.java?view=auto&rev=521453 ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/HoldCursorTest.java (added) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/HoldCursorTest.java Thu Mar 22 13:50:47 2007 @@ -0,0 +1,415 @@ +/* Derby - Class org.apache.derbyTesting.functionTests.tests.lang.HoldCursorTest + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file ecept in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the License. + */ + +package org.apache.derbyTesting.functionTests.tests.lang; + +import java.sql.PreparedStatement; +import java.sql.CallableStatement; +import java.sql.ResultSet; +import java.sql.Connection; +import java.sql.SQLException; +import java.sql.Statement; +import java.sql.DriverManager; +import junit.framework.Test; +import junit.framework.TestSuite; + +import org.apache.derbyTesting.junit.BaseJDBCTestCase; +import org.apache.derbyTesting.junit.JDBC; +import org.apache.derbyTesting.junit.CleanDatabaseTestSetup; + +/** + * Test hold cursor after commit + */ +public class HoldCursorTest extends BaseJDBCTestCase { + /** + * Public constructor required for running test as standalone JUnit. + */ + public HoldCursorTest(String name) { + super(name); + } + /** + * Create a suite of tests. + */ + + + public static Test suite() { + if ( !JDBC.vmSupportsJDBC3()) + return new TestSuite("empty HoldCursorTest - supported only from JDBC3.0 and above"); + else{ + TestSuite suite = new TestSuite("HoldCursorTest"); + suite.addTest(baseSuite("HoldCursorTest:embedded")); + suite.addTest(baseSuite("HoldCursorTest:client")); + return suite; + } + } + private static Test baseSuite(String name) { + + TestSuite suite = new TestSuite(name); + + // Add tests that every JVM jdk1.4 or above should be able to run. + suite.addTestSuite(HoldCursorTest.class); + if (!JDBC.vmSupportsJSR169()) { + suite.addTest (new HoldCursorTest("StatementsInProcedureTest")); + + } + return new CleanDatabaseTestSetup(suite); + } + /** + * Set the fixture up with tables and insert rows . + */ + protected void setUp() throws SQLException { + getConnection().setAutoCommit(false); + Statement stmt = createStatement(); + final int stringLength = 400; + stmt.executeUpdate("CREATE TABLE T1 (c11 int, c12 int, junk varchar(" + + stringLength + "))"); + PreparedStatement insertStmt = prepareStatement("INSERT INTO T1 VALUES(?,1,?)"); + // We need to ensure that there is more data in the table than the + // client can fetch in one message (about 32K). Otherwise, the + // cursor might be closed on the server and we are not testing the + // same thing in embedded mode and client/server mode. + final int rows = 40000 / stringLength; + StringBuffer buff = new StringBuffer(stringLength); + for (int i = 0; i < stringLength; i++) { + buff.append(" "); + } + for (int i = 1; i <= rows; i++) { + insertStmt.setInt(1, i); + insertStmt.setString(2, buff.toString()); + insertStmt.executeUpdate(); + } + insertStmt.close(); + stmt.executeUpdate( "CREATE TABLE T2 (c21 int, c22 int)" ); + stmt.executeUpdate("INSERT INTO T2 VALUES(1,1)"); + stmt.executeUpdate("INSERT INTO T2 VALUES(1,2)"); + stmt.executeUpdate("INSERT INTO T2 VALUES(1,3)"); + stmt.execute("create table testtable1 (id integer, vc varchar(100))"); + stmt.execute("insert into testtable1 values (11, 'testtable1-one'), (12, 'testtable1-two')"); + stmt.execute("create table testtable2 (id integer, vc varchar(100))"); + stmt.execute("insert into testtable2 values (21, 'testtable2-one'), (22, 'testtable2-two')"); + stmt.execute("create procedure MYPROC() language java parameter style java external name " + + "'org.apache.derbyTesting.functionTests.tests.lang.HoldCursorTest.testProc' result sets 2"); + stmt.executeUpdate("Create table bug4385 (i int not null primary key, c int generated always as identity)"); + stmt.close(); + commit(); + } + /** + * Drop tables for clean up + */ + protected void tearDown() throws Exception { + Statement stmt = createStatement(); + stmt.executeUpdate( "DROP PROCEDURE MYPROC" ); + stmt.executeUpdate( "DROP TABLE T1" ); + stmt.executeUpdate( "DROP TABLE T2" ); + stmt.executeUpdate( "DROP TABLE testtable1" ); + stmt.executeUpdate( "DROP TABLE testtable2" ); + stmt.executeUpdate( "DROP TABLE BUG4385" ); + stmt.close(); + stmt.close(); + commit(); + super.tearDown(); + } + /** + * test cursor holdability after commit on multi table query + * @throws Exception + */ + public void testHoldCursorOnMultiTableQuery() throws Exception + { + ResultSet rs; + Statement s = createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT ); + + //open a cursor with multiple rows resultset + rs = s.executeQuery("select t1.c11, t2.c22 from t1, t2 where t1.c11=t2.c21"); + rs.next(); + assertEquals("1", rs.getString(2)); + commit(); + rs.next(); //because holdability is true, should be able to navigate the cursor after commit + assertEquals("2", rs.getString(2)); + rs.close(); + } + /** + * Test Chaging isolation levels with and without held curosors + * @throws Exception + */ + public void testIsolationLevelChange() throws Exception + { + ResultSet rs; + //set current isolation to read committed + setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); + Statement s = createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY,ResultSet.HOLD_CURSORS_OVER_COMMIT ); + //open a cursor with multiple rows resultset + rs = s.executeQuery("select * from t1"); + rs.next(); + + //Changing to different isolation from the current isolation for connection + //will give an exception because there are held cursors + assertIsolationError("X0X03",Connection.TRANSACTION_SERIALIZABLE); + + //Close open cursors and then try changing to different isolation. + //It should work. + rs.close(); + setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE); + + // set the default holdability for the Connection and try setting the isolation level + setHoldability(ResultSet.HOLD_CURSORS_OVER_COMMIT); + setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED); + createStatement().executeUpdate("SET ISOLATION RS"); + + // test for bug4385 - internal ResultSets were being re-used incorrectly + // will occur in with JDBC 2.0,1.2 but the first statement I found that + // failed was an insert with generated keys. + + PreparedStatement ps = prepareStatement("insert into bug4385(i) values(?)", Statement.RETURN_GENERATED_KEYS); + ps.setInt(1, 199); + ps.executeUpdate(); + assertGetIntEquals(1,1,ps.getGeneratedKeys()); + rs.close(); + + ps.setInt(1, 299); + ps.executeUpdate(); + assertGetIntEquals(1,2,ps.getGeneratedKeys()); + rs.close(); + ps.close(); + rollback(); + + //switch back to default isolation & holdability + setHoldability(ResultSet.CLOSE_CURSORS_AT_COMMIT); + setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); + } + /** + * Test that drop table cannot be performed when there is an open + * cursor on that table. + * + * @exception SQLException + */ + public void testDropTable() throws SQLException { + setHoldability(ResultSet.HOLD_CURSORS_OVER_COMMIT); + final String dropTable = "DROP TABLE T1"; + Statement stmt1 = createStatement(); + Statement stmt2 = createStatement(); + ResultSet rs = stmt1.executeQuery("SELECT * FROM T1"); + rs.next(); + assertStatementError("X0X95", stmt2,dropTable); + + // dropping t1 should fail because there is an open cursor on t1 + assertStatementError("X0X95", stmt2,dropTable); + commit(); + + // cursors are held over commit, so dropping should still fail + assertStatementError("X0X95", stmt2,dropTable); + rs.close(); + + // cursor is closed, so this one should succeed + stmt2.executeUpdate(dropTable); + stmt1.close(); + stmt2.close(); + rollback(); + } + /** + * set connection holdability and test holdability of statements inside and outside procedures + * test that holdability of statements always overrides holdability of connection + * @throws SQLException + */ + public void testHoldabilityOverCommit() throws SQLException{ + testStatements(ResultSet.HOLD_CURSORS_OVER_COMMIT); + testStatements(ResultSet.CLOSE_CURSORS_AT_COMMIT); + } + + public void StatementsInProcedureTest()throws SQLException{ + StatementsInProcedure(ResultSet.HOLD_CURSORS_OVER_COMMIT); + StatementsInProcedure(ResultSet.CLOSE_CURSORS_AT_COMMIT); + } + + /** + * test holdability of statements outside procedures + * @param holdability + * @throws SQLException + */ + public void testStatements(int holdability) throws SQLException{ + setHoldability(holdability); + //HOLD_CURSORS_OVER_COMMIT + Statement st1 = createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE , + ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT); + ResultSet rs1 = st1.executeQuery("select * from testtable1"); + rs1.next(); + assertEquals(11,rs1.getInt(1)); + + commit(); + rs1.next(); + assertEquals(12,rs1.getInt(1)); + st1.close(); + + //CLOSE_CURSORS_AT_COMMIT + Statement st2 = createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE , + ResultSet.CONCUR_READ_ONLY, ResultSet.CLOSE_CURSORS_AT_COMMIT); + ResultSet rs2 = st2.executeQuery("select * from testtable2"); + rs2.next(); + assertEquals(21,rs2.getInt(1)); + commit(); + assertNextError("XCL16",rs2); + st2.close(); + rs1.close(); + rs2.close(); + } + + /** + * test holdability of statements in procedures + * @param holdability + * @throws SQLException + */ + public void StatementsInProcedure(int holdability) throws SQLException{ + setHoldability(holdability); + CallableStatement cs1 = prepareCall("call MYPROC()"); + cs1.execute(); + ResultSet rs2 = cs1.getResultSet(); + rs2.next(); + assertEquals(11,rs2.getInt(1)); + rs2.next(); + assertEquals(12,rs2.getInt(1)); + + CallableStatement cs2 = prepareCall("call MYPROC()"); + cs2.execute(); + commit(); + ResultSet rs1 = cs2.getResultSet(); + rs1.next(); + assertEquals(11,rs1.getInt(1)); + if(rs1.next()) + assertEquals(12,rs1.getInt(1)); + else + assertNull(rs1); + cs1.close(); + cs2.close(); + rs1.close(); + rs2.close(); + } + /** + * Test for drop table after closing the cursor + * @throws SQLException + */ + public void testCloseCursor()throws SQLException + { + // Run this test on one large table (T1) where the network + // server won't close the cursor implicitly, and on one small + // table (T2) where the network server will close the cursor + // implicitly. + final String[] tables = { "T1", "T2" }; + Statement stmt1 = createStatement(); + Statement stmt2 = createStatement(); + for (int i = 0; i < tables.length; i++) { + String table = tables[i]; + ResultSet rs = stmt1.executeQuery("SELECT * FROM " + table); + rs.next(); + rs.close(); + // Cursor is closed, so this should succeed. If the cursor + // is open, it will fail because a table cannot be + // dropped when there are open cursors depending on it. + stmt2.executeUpdate("DROP TABLE " + table); + } + stmt1.close(); + stmt2.close(); + rollback(); + } + /** + * Assert that the changing isolation throws + * an SQLException with the expected state. + * @param sqlState + * @param level + */ + public void assertIsolationError(String sqlState, int level) { + + try { + getConnection().setTransactionIsolation(level); + fail("expected compile error: " + sqlState); + } catch (SQLException se) { + assertSQLState(sqlState, se); + } + } + /** + * Utility method to create a Statement using the connection + * returned by getConnection. + * @param resultSetType + * @param resultSetConcurrency + * @param resultSetHoldability + * @return + * @throws SQLException + */ + public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException + { + return getConnection().createStatement(resultSetType, resultSetConcurrency,resultSetHoldability); + } + /** + * Utility method to set Transaction Isolation + * @param level + * @throws SQLException + */ + public void setTransactionIsolation(int level) throws SQLException + { + getConnection().setTransactionIsolation(level); + } + /** + * Utility method to set Holdability + * @param holdability + * @throws SQLException + */ + public void setHoldability(int holdability) throws SQLException + { + getConnection().setHoldability(holdability); + } + /** + * Perform getInt(position) with expected error + * @param position + * @param expected + * @param rs + */ + public static void assertGetIntEquals(int position,int expected,ResultSet rs) + { + try{ + while(rs.next()){ + if(expected==rs.getInt(position)) + return; + else + fail("Wrong value returned: "+ rs.getInt(position)); + } + }catch(SQLException se){ + se.printStackTrace(); + + } + + } + /** + * Java method for stored procedure + * @param rs1 + * @param rs2 + * @throws Exception + */ + public static void testProc(ResultSet[] rs1, ResultSet[] rs2) throws Exception + { + Connection conn = DriverManager.getConnection("jdbc:default:connection"); + + //HOLD_CURSORS_OVER_COMMIT + Statement st1 = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE , + ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT); + rs1[0] = st1.executeQuery("select * from testtable1"); + + //CLOSE_CURSORS_AT_COMMIT + Statement st2 = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE , + ResultSet.CONCUR_READ_ONLY, ResultSet.CLOSE_CURSORS_AT_COMMIT); + rs2[0] = st2.executeQuery("select * from testtable2"); + + } +} Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/HoldCursorTest.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java?view=diff&rev=521453&r1=521452&r2=521453 ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java Thu Mar 22 13:50:47 2007 @@ -85,6 +85,7 @@ suite.addTest(InListMultiProbeTest.suite()); suite.addTest(CurrentOfTest.suite()); suite.addTest(UnaryArithmeticParameterTest.suite()); + suite.addTest(HoldCursorTest.suite()); suite.addTest(ShutdownDatabaseTest.suite()); // Add the XML tests, which exist as a separate suite