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 rh...@apache.org on 2006/08/25 22:02:11 UTC

svn commit: r436921 [4/5] - in /db/derby/code/branches/10.2: ./ java/engine/org/apache/derby/iapi/sql/depend/ java/engine/org/apache/derby/iapi/sql/dictionary/ java/engine/org/apache/derby/iapi/sql/execute/ java/engine/org/apache/derby/impl/sql/catalog...

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/triggerGeneral.out
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/triggerGeneral.out?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/triggerGeneral.out (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/triggerGeneral.out Fri Aug 25 13:02:02 2006
@@ -1136,4 +1136,131 @@
 3 rows inserted/updated/deleted
 ij> UPDATE TEST SET INFO = 1 WHERE TESTID = 2;
 ERROR 54038: Maximum depth of nested triggers was exceeded.
+ij> drop table test;
+0 rows inserted/updated/deleted
+ij> -- DERBY-1621
+-- creating and dropping index on the table in the trigger action
+create table t1 (i int);
+0 rows inserted/updated/deleted
+ij> create table t2 (i int);
+0 rows inserted/updated/deleted
+ij> create trigger tt after insert on t1 for each statement mode db2sql insert into t2 values 1;
+0 rows inserted/updated/deleted
+ij> insert into t1 values 1;
+1 row inserted/updated/deleted
+ij> create unique index tu on t2(i);
+0 rows inserted/updated/deleted
+ij> insert into t1 values 1;
+ERROR 23505: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'TU' defined on 'T2'.
+ij> select * from t2;
+I          
+-----------
+1          
+ij> insert into t1 values 1;
+ERROR 23505: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'TU' defined on 'T2'.
+ij> select * from t2;
+I          
+-----------
+1          
+ij> drop index tu;
+0 rows inserted/updated/deleted
+ij> select * from t2;
+I          
+-----------
+1          
+ij> insert into t1 values 1;
+1 row inserted/updated/deleted
+ij> select * from t2;
+I          
+-----------
+1          
+1          
+ij> drop trigger tt;
+0 rows inserted/updated/deleted
+ij> -- dropping and recreating a table which the trigger references
+create table t3 (i int);
+0 rows inserted/updated/deleted
+ij> create table t4 (i int);
+0 rows inserted/updated/deleted
+ij> create trigger tt2 after insert on t3 for each statement mode db2sql insert into t4 values 1;
+0 rows inserted/updated/deleted
+ij> insert into t3 values 1;
+1 row inserted/updated/deleted
+ij> select * from t4;
+I          
+-----------
+1          
+ij> drop table t4;
+0 rows inserted/updated/deleted
+ij> insert into t3 values 1;
+ERROR 42X05: Table/View 'T4' does not exist.
+ij> create table t4 (i int);
+0 rows inserted/updated/deleted
+ij> insert into t3 values 1;
+1 row inserted/updated/deleted
+ij> select * from t4;
+I          
+-----------
+1          
+ij> -- dropping a function which the trigger references
+create function max_value(x int, y int) returns int language java parameter style java external name 'java.lang.Math.max';
+0 rows inserted/updated/deleted
+ij> create table test(a integer);
+0 rows inserted/updated/deleted
+ij> create trigger test_trigger AFTER insert on test FOR EACH ROW MODE DB2SQL values max_value(2,4);
+0 rows inserted/updated/deleted
+ij> insert into test values(1);
+1 row inserted/updated/deleted
+ij> --- drop function and again do inserts. these should not work as the trigger would be invalid
+drop function max_value;
+0 rows inserted/updated/deleted
+ij> insert into test values(2);
+ERROR 42Y03: 'MAX_VALUE' is not recognized as a function or procedure.
+ij> insert into test values(1);
+ERROR 42Y03: 'MAX_VALUE' is not recognized as a function or procedure.
+ij> -- dropping a view which the trigger references
+create table t11TriggerTest (c111 int not null primary key, c112 int);
+0 rows inserted/updated/deleted
+ij> insert into t11TriggerTest values(1,1);
+1 row inserted/updated/deleted
+ij> insert into t11TriggerTest values(2,2);
+1 row inserted/updated/deleted
+ij> -- create a view based on table t11TriggerTest
+create view v21ViewTest as select * from t11TriggerTest;
+0 rows inserted/updated/deleted
+ij> -- get ready to create a trigger. Trigger is created on t31TriggerTest and it inserts into t32TriggerTest
+create table t31TriggerTest (c311 int);
+0 rows inserted/updated/deleted
+ij> create table t32TriggerTest (c321 int);
+0 rows inserted/updated/deleted
+ij> create trigger tr31t31TriggerTest after insert on t31TriggerTest for each statement mode db2sql
+   insert into t32TriggerTest values (select c111 from v21ViewTest where c112=1);
+0 rows inserted/updated/deleted
+ij> -- try an insert which will fire the trigger
+insert into t31TriggerTest values(1);
+1 row inserted/updated/deleted
+ij> select * from t31TriggerTest;
+C311       
+-----------
+1          
+ij> -- we know the trigger got fired if there is one row in t32TriggerTest
+select * from t32TriggerTest;
+C321       
+-----------
+1          
+ij> -- drop the view used by the trigger.
+drop view v21ViewTest;
+0 rows inserted/updated/deleted
+ij> -- try an insert which would cause insert trigger to fire. The insert trigger should have failed because view doesn't
+-- exist anymore.
+insert into t31TriggerTest values(1);
+ERROR 42X05: Table/View 'V21VIEWTEST' does not exist.
+ij> select * from t31TriggerTest;
+C311       
+-----------
+1          
+ij> select * from t32TriggerTest;
+C321       
+-----------
+1          
 ij> 

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNet.exclude
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNet.exclude?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNet.exclude (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNet.exclude Fri Aug 25 13:02:02 2006
@@ -42,3 +42,6 @@
 # Excluding ResultSetClose test since an exception in a statement results in all
 # the result sets associated with the connection closing
 jdbcapi/ResultSetCloseTest.junit
+# DERBY-1691: when run against JCC, exceptions in blobclob4BLOB can appear in
+# different places in the output.
+jdbcapi/blobclob4BLOB.java

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/ShutDownDBWhenNSShutsDownTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/ShutDownDBWhenNSShutsDownTest.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/ShutDownDBWhenNSShutsDownTest.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/ShutDownDBWhenNSShutsDownTest.java Fri Aug 25 13:02:02 2006
@@ -144,7 +144,7 @@
     }
 
     private void createDatabase() throws SQLException {
-        Connection conn = getXConnection();
+        Connection conn = getConnection();
         conn.setAutoCommit(false);
         Statement st = conn.createStatement();
         st.execute("CREATE TABLE T1 (a int)");

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/AutoloadBooting.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/AutoloadBooting.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/AutoloadBooting.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/AutoloadBooting.java Fri Aug 25 13:02:02 2006
@@ -348,7 +348,7 @@
 	private	void	loadNetworkClientDriver()
 		throws Exception
 	{
-		boolean		isAutoloading = !CONFIG.autoloading();
+		boolean		isAutoloading = !getTestConfiguration().autoloading();
 		
 		//
 		// Forcibly load the network client if we are not autoloading it.

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/AutoloadTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/AutoloadTest.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/AutoloadTest.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/AutoloadTest.java Fri Aug 25 13:02:02 2006
@@ -101,7 +101,7 @@
 		// We expect that the connection to the database will fail for
 		// one reason or another.
 		//
-		if ( CONFIG.autoloading() )
+		if ( getTestConfiguration().autoloading() )
 		{
 			println( "We ARE autoloading..." );
 
@@ -136,12 +136,12 @@
 	private	void	failToConnect( String expectedSQLState )
 		throws Exception
 	{
-		String			connectionURL = CONFIG.getJDBCUrl( NONEXISTENT_DATABASE );
+		String			connectionURL = getTestConfiguration().getJDBCUrl( NONEXISTENT_DATABASE );
 		Properties		properties = new Properties();
 		SQLException 	se = null;
 
-		properties.put( "user", CONFIG.getUserName() );
-		properties.put( "password", CONFIG.getUserPassword() );
+		properties.put( "user", getTestConfiguration().getUserName() );
+		properties.put( "password", getTestConfiguration().getUserPassword() );
 
 		try {
 			println( "Attempting to connect with this URL: '" + connectionURL + "'" );

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobClobTestSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobClobTestSetup.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobClobTestSetup.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobClobTestSetup.java Fri Aug 25 13:02:02 2006
@@ -25,6 +25,7 @@
 import junit.framework.Test;
 
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.BaseJDBCTestSetup;
 
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
@@ -39,17 +40,13 @@
  * because the createBlob/-Clob methods are not yet implemented.
  */
 public class BlobClobTestSetup
-    extends TestSetup {
+    extends BaseJDBCTestSetup {
 
     /** Constant for accessing the row with null values. */
     public static final int ID_NULLVALUES = 1;
     /** Constant for accessing the row with sample values. */
     public static final int ID_SAMPLEVALUES = 2;
 
-    /** ResultSet used to fetch BLOB or CLOB. */
-    private static ResultSet rs = null;
-    /** Statement used to fetch BLOB or CLOB. */
-    private static Statement stmt = null;
     /** Blob data. */
     private static final byte[] blobData = new byte[] {
         0x65, 0x66, 0x67, 0x68, 0x69,
@@ -72,9 +69,9 @@
      * Create a table with BLOB and CLOB, so that such objects can be
      * accessed/used from JDBC.
      */
-    public void setUp() 
+    protected void setUp() 
         throws IOException, SQLException {
-        Connection con = BaseJDBCTestCase.getConnection();
+        Connection con = getConnection();
         Statement stmt = con.createStatement();
         stmt.execute("create table BLOBCLOB (ID int primary key, " +
                                             "BLOBDATA blob(1k)," + 
@@ -89,14 +86,15 @@
 
     /**
      * Drop the table we created during setup.
+     * @throws Exception 
      */
-    public void tearDown()
-        throws SQLException {
-        Connection con = BaseJDBCTestCase.getConnection();
+    protected void tearDown()
+        throws Exception {
+        Connection con = getConnection();
         Statement stmt = con.createStatement();
         stmt.execute("drop table BLOBCLOB");
         stmt.close();
-        con.close();
+        super.tearDown();
     }
     
     /**
@@ -119,8 +117,8 @@
         pStmt.setBlob(1, blobInput, blobData.length);
         pStmt.setInt(2, ID_SAMPLEVALUES);
         assertEquals("Invalid update count", 1, pStmt.executeUpdate());
-        stmt = con.createStatement();
-        rs = stmt.executeQuery("select BLOBDATA from BLOBCLOB where ID = " +
+        Statement stmt = con.createStatement();
+        ResultSet rs = stmt.executeQuery("select BLOBDATA from BLOBCLOB where ID = " +
                 ID_SAMPLEVALUES);
         rs.next();
         Blob blob = rs.getBlob(1);
@@ -149,8 +147,8 @@
         pStmt.setClob(1, clobInput, clobData.length());
         pStmt.setInt(2, ID_SAMPLEVALUES);
         assertEquals("Invalid update count", 1, pStmt.executeUpdate());
-        stmt = con.createStatement();
-        rs = stmt.executeQuery("select CLOBDATA from BLOBCLOB where ID = " +
+        Statement stmt = con.createStatement();
+        ResultSet rs = stmt.executeQuery("select CLOBDATA from BLOBCLOB where ID = " +
                 ID_SAMPLEVALUES);
         rs.next();
         Clob clob = rs.getClob(1);

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobTest.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobTest.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobTest.java Fri Aug 25 13:02:02 2006
@@ -119,8 +119,6 @@
 
     /** Default Blob object used by the tests. */
     private Blob blob = null;
-    /** Default connection used by the tests. */
-    private Connection con = null;
     
     // Initialize with the details of the method that are exempted from 
     //throwing a SQLException when they are called after calling free()
@@ -156,24 +154,14 @@
     
     public void setUp() 
         throws SQLException {
-        con = getConnection();
-        blob = BlobClobTestSetup.getSampleBlob(con);
+
+        blob = BlobClobTestSetup.getSampleBlob(getConnection());
         
         //call the buildHashSetMethod to initialize the 
         //HashSet with the method signatures that are exempted 
         //from throwing a SQLException after free has been called
         //on the Clob object.
         buildHashSet();
-    }
-    
-    public void tearDown()
-        throws SQLException {
-        blob = null;
-        if (con != null && !con.isClosed()) {
-            con.rollback();
-            con.close();
-        }
-        con = null;
     }
     
     /**

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTest.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTest.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTest.java Fri Aug 25 13:02:02 2006
@@ -37,8 +37,7 @@
 public class CallableStatementTest
     extends BaseJDBCTestCase {
 
-    /** Default connection used by the tests. */
-    private Connection con = null;
+
     /** Default callable statement used by the tests. */
     private CallableStatement cStmt = null;
     
@@ -57,10 +56,9 @@
      * @throws SQLException if creation of connection or callable statement
      *                      fail.
      */
-    public void setUp() 
+    protected void setUp() 
         throws SQLException {
-        con = getConnection();
-        cStmt = con.prepareCall("? = CALL FLOOR(?)");
+        cStmt = prepareCall("? = CALL FLOOR(?)");
         cStmt.registerOutParameter(1, Types.DOUBLE);
     }
 
@@ -70,22 +68,18 @@
      * @throws SQLException if closing of the connection or the callable
      *                      statement fail.
      */
-    public void tearDown()
-        throws SQLException {
+    protected void tearDown()
+        throws Exception {
         if (cStmt != null && !cStmt.isClosed()) {
             cStmt.close();
         }
-        if (con != null && !con.isClosed()) {
-            con.rollback();
-            con.close();
-        }
-        cStmt = null;
-        con = null;
+
+        super.tearDown();
     }
    
     public void testNamedParametersAreNotSupported()
         throws SQLException {
-        DatabaseMetaData met = con.getMetaData();
+        DatabaseMetaData met = getConnection().getMetaData();
         assertFalse("Named parameters are not supported, but the metadata " +
                     "says they are", met.supportsNamedParameters());
         met = null;
@@ -191,7 +185,7 @@
      */
     public void testGetCharacterStreamIntOnInParameterOfValidType()
         throws SQLException {
-        cStmt = CallableStatementTestSetup.getBinaryDirectProcedure(con);
+        cStmt = CallableStatementTestSetup.getBinaryDirectProcedure(getConnection());
         cStmt.setString(1, "A string");
         cStmt.execute();
         try {
@@ -215,7 +209,7 @@
      */
     public void testGetCharacterStreamIntVARCHAR()
         throws IOException, SQLException {
-        cStmt = CallableStatementTestSetup.getIntToStringFunction(con);
+        cStmt = CallableStatementTestSetup.getIntToStringFunction(getConnection());
         cStmt.setInt(2, 4509);
         assertFalse("No resultsets should be returned", cStmt.execute());
         assertEquals("Incorrect updatecount", -1, cStmt.getUpdateCount());
@@ -246,7 +240,7 @@
     public void testGetCharacterStreamIntVARBINARYDirect()
         throws IOException, SQLException {
         String data = "This is the test string.";
-        cStmt = CallableStatementTestSetup.getBinaryDirectProcedure(con);
+        cStmt = CallableStatementTestSetup.getBinaryDirectProcedure(getConnection());
         cStmt.setString(1, data);
         assertFalse("No resultsets should be returned", cStmt.execute());
         // Note that getUpdateCount behaves differently on client and embedded.
@@ -285,7 +279,7 @@
      */
     public void testGetCharacterStreamIntVARBINARYFromDb()
         throws IOException, SQLException {
-        cStmt = CallableStatementTestSetup.getBinaryFromDbFunction(con);
+        cStmt = CallableStatementTestSetup.getBinaryFromDbFunction(getConnection());
         cStmt.setInt(2, CallableStatementTestSetup.STRING_BYTES_ID);
         assertFalse("No resultsets should be returned", cStmt.execute());
         assertEquals("Incorrect updatecount", -1, cStmt.getUpdateCount());
@@ -316,7 +310,7 @@
      */
     public void testGetCharacterStreamIntOnVARBINARYWithNull()
         throws SQLException {
-        cStmt = CallableStatementTestSetup.getBinaryFromDbFunction(con);
+        cStmt = CallableStatementTestSetup.getBinaryFromDbFunction(getConnection());
         cStmt.setInt(2, CallableStatementTestSetup.SQL_NULL_ID);
         assertFalse("No resultsets should be returned", cStmt.execute());
         assertEquals("Incorrect updatecount", -1, cStmt.getUpdateCount());
@@ -331,7 +325,7 @@
      */
     public void testGetCharacterStreamIntOnVARCHARWithNull()
         throws SQLException {
-        cStmt = CallableStatementTestSetup.getVarcharFromDbFunction(con);
+        cStmt = CallableStatementTestSetup.getVarcharFromDbFunction(getConnection());
         cStmt.setInt(2, CallableStatementTestSetup.SQL_NULL_ID);
         assertFalse("No resultsets should be returned", cStmt.execute());
         assertEquals("Incorrect updatecount", -1, cStmt.getUpdateCount());

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTestSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTestSetup.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTestSetup.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTestSetup.java Fri Aug 25 13:02:02 2006
@@ -26,6 +26,7 @@
 import junit.extensions.TestSetup;
 
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.BaseJDBCTestSetup;
 
 import java.io.UnsupportedEncodingException;
 import java.sql.*;
@@ -38,7 +39,7 @@
  * functions and procedures.
  */
 public class CallableStatementTestSetup
-    extends TestSetup {
+    extends BaseJDBCTestSetup {
 
     private static final String SOURCECLASS = "org.apache.derbyTesting." +
         "functionTests.tests.jdbc4.CallableStatementTestSetup.";
@@ -74,9 +75,9 @@
         super(test);
     }
 
-    public void setUp()
+    protected void setUp()
         throws SQLException {
-        Connection con = BaseJDBCTestCase.getConnection();
+        Connection con = getConnection();
         // Create the tables, functions and procedures we need.
         Statement stmt = con.createStatement();
         // Create table CSDATA and populate
@@ -122,11 +123,12 @@
                 "RETURNS VARCHAR(256) " +
                 "PARAMETER STYLE JAVA READS SQL DATA LANGUAGE JAVA " +
                 "EXTERNAL NAME '" + SOURCECLASS + "getVarcharFromDb'");
+        stmt.close();
     }
 
-    public void tearDown()
-        throws SQLException {
-        Connection con = BaseJDBCTestCase.getConnection();
+    protected void tearDown()
+        throws Exception {
+        Connection con = getConnection();
         Statement stmt = con.createStatement();
         // Drop functions
         for (String function : FUNCTION_DROPS) {
@@ -141,7 +143,7 @@
             stmt.execute("DROP TABLE "  + table);
         }
         stmt.close();
-        con.close();
+        super.tearDown();
     }
 
     // Methods for getting CallableStatements

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ClobTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ClobTest.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ClobTest.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ClobTest.java Fri Aug 25 13:02:02 2006
@@ -120,8 +120,6 @@
 
     /** Default Clob object used by the tests. */
     private Clob clob = null;
-    /** Default connection used by the tests. */
-    private Connection con = null;
     
     // Initialize with the details of the method that are exempted from 
     //throwing a SQLException when they are called after calling free()
@@ -155,24 +153,13 @@
     
     public void setUp() 
         throws SQLException {
-        con = getConnection();
-        clob = BlobClobTestSetup.getSampleClob(con);
+        clob = BlobClobTestSetup.getSampleClob(getConnection());
         
         //call the buildHashSetMethod to initialize the 
         //HashSet with the method signatures that are exempted 
         //from throwing a SQLException after free has been called
         //on the Clob object.
         buildHashSet();
-    }
-
-    public void tearDown()
-        throws SQLException {
-        clob = null;
-        if (con != null && !con.isClosed()) {
-            con.rollback();
-            con.close();
-        }
-        con = null;
     }
     
     /**

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ClosedObjectTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ClosedObjectTest.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ClosedObjectTest.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ClosedObjectTest.java Fri Aug 25 13:02:02 2006
@@ -42,6 +42,7 @@
 import junit.framework.TestSuite;
 import org.apache.derbyTesting.functionTests.util.TestDataSourceFactory;
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.TestConfiguration;
 
 /**
  * Test that all methods on <code>ResultSet</code>,
@@ -698,8 +699,8 @@
          */
         protected Connection newConnection_() throws SQLException {
             DataSource ds = TestDataSourceFactory.getDataSource();
-            return ds.getConnection(CONFIG.getUserName(),
-                                    CONFIG.getUserPassword());
+            return ds.getConnection(TestConfiguration.getCurrent().getUserName(),
+                    TestConfiguration.getCurrent().getUserPassword());
         }
     }
 
@@ -727,8 +728,8 @@
         protected Connection newConnection_() throws SQLException {
             ConnectionPoolDataSource ds = TestDataSourceFactory.getConnectionPoolDataSource();
             PooledConnection pc =
-                ds.getPooledConnection(CONFIG.getUserName(),
-                                       CONFIG.getUserPassword());
+                ds.getPooledConnection(TestConfiguration.getCurrent().getUserName(),
+                        TestConfiguration.getCurrent().getUserPassword());
             return pc.getConnection();
         }
     }
@@ -755,8 +756,8 @@
          */
         protected Connection newConnection_() throws SQLException {
             XADataSource ds = TestDataSourceFactory.getXADataSource();
-            XAConnection xac = ds.getXAConnection(CONFIG.getUserName(),
-                                                  CONFIG.getUserPassword());
+            XAConnection xac = ds.getXAConnection(TestConfiguration.getCurrent().getUserName(),
+                    TestConfiguration.getCurrent().getUserPassword());
             return xac.getConnection();
         }
     }

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ConnectionTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ConnectionTest.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ConnectionTest.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ConnectionTest.java Fri Aug 25 13:02:02 2006
@@ -47,11 +47,6 @@
 public class ConnectionTest
     extends BaseJDBCTestCase {
 
-    /** 
-     * Default connection used by the tests. 
-     */
-    protected Connection con = null;
-
     /**
      * Create a test with the given name.
      * 
@@ -60,23 +55,6 @@
     public ConnectionTest(String name) {
         super(name);
     }
-    
-    /**
-     * Obtain a connection that the tests can use.
-     */
-    public void setUp() 
-        throws SQLException {
-        con = getConnection(); 
-    }
-
-    public void tearDown() 
-        throws SQLException {
-        if (con != null && !con.isClosed()) {
-            con.rollback();
-            con.close();
-        }
-        con = null;
-    }
    
     //------------------------- T E S T  M E T H O D S ------------------------
     
@@ -94,7 +72,7 @@
      */
     public void embeddedCreateBlob()
         throws SQLException {
-            Blob blob = con.createBlob();
+            Blob blob = getConnection().createBlob();
             //Check if the blob is empty
             if(blob.length() > 0)
                 fail("The new Blob should not have more than zero bytes " +
@@ -115,7 +93,7 @@
      */
     public void embeddedCreateClob()
         throws SQLException {
-            Clob clob = con.createClob();
+            Clob clob = getConnection().createClob();
             //check if the Clob is empty
             if(clob.length() > 0)
                 fail("The new Clob should not have a length of greater than " +
@@ -125,7 +103,7 @@
     public void testCreateArrayNotImplemented()
         throws SQLException {
         try {
-            con.createArrayOf(null, null);
+            getConnection().createArrayOf(null, null);
             fail("createArrayOf(String,Object[]) should not be implemented");
         } catch (SQLFeatureNotSupportedException sfnse) {
             // Do nothing, we are fine
@@ -135,7 +113,7 @@
     public void testCreateNClobNotImplemented()
         throws SQLException {
         try {
-            con.createNClob();
+            getConnection().createNClob();
             fail("createNClob() should not be implemented");
         } catch (SQLFeatureNotSupportedException sfnse) {
             // Do nothing, we are fine
@@ -151,14 +129,14 @@
      */
     public void testCreateQueryObjectIsImplemented()
         throws SQLException {
-        con.createQueryObject(TestQuery.class);
-        con.createQueryObject(TestQuery.class, con);
+        getConnection().createQueryObject(TestQuery.class);
+        getConnection().createQueryObject(TestQuery.class, getConnection());
     }
 
     public void testCreateSQLXMLNotImplemented()
         throws SQLException {
         try {
-            con.createSQLXML();
+            getConnection().createSQLXML();
             fail("createSQLXML() should not be implemented");
         } catch (SQLFeatureNotSupportedException sfnse) {
             // Do nothing, we are fine
@@ -168,7 +146,7 @@
     public void testCreateStructNotImplemented()
         throws SQLException {
         try {
-            con.createStruct(null, null);
+            getConnection().createStruct(null, null);
             fail("createStruct(String,Object[]) should not be implemented");
         } catch (SQLFeatureNotSupportedException sfnse) {
             // Do nothing, we are fine
@@ -178,15 +156,15 @@
     public void testGetClientInfo()
         throws SQLException {
         assertTrue("getClientInfo() must return an empty Properties object", 
-                   con.getClientInfo().isEmpty());
+                   getConnection().getClientInfo().isEmpty());
     }
     
     public void testGetClientInfoString()
         throws SQLException {
         assertNull("getClientInfo(null) must return null",
-                   con.getClientInfo(null));
+                   getConnection().getClientInfo(null));
         assertNull("getClientInfo(\"someProperty\") must return null",
-                   con.getClientInfo("someProperty"));
+                   getConnection().getClientInfo("someProperty"));
     }
 
     /**
@@ -198,14 +176,14 @@
      */
     public void testIsValidImplemented() throws SQLException {
         // Test with an infinite (0) timeout
-        assertTrue(con.isValid(0));
+        assertTrue(getConnection().isValid(0));
 
         // Test with a 1 second timeout
-        assertTrue(con.isValid(1));
+        assertTrue(getConnection().isValid(1));
 
         // Test with an illegal timeout
         try {
-            con.isValid(-1);
+            getConnection().isValid(-1);
         } catch (SQLException sqle) {
             assertSQLState("Incorrect SQL state when calling isValid(-1)",
                            "XJ081", sqle);
@@ -218,29 +196,29 @@
      * @exception SQLException if an error occurs
      */
     public void testGetTypeMapReturnsEmptyMap() throws SQLException {
-        assertTrue(con.getTypeMap().isEmpty());
+        assertTrue(getConnection().getTypeMap().isEmpty());
     }
 
     public void testIsWrapperReturnsFalse()
         throws SQLException {
-        assertFalse(con.isWrapperFor(ResultSet.class));
+        assertFalse(getConnection().isWrapperFor(ResultSet.class));
     }
 
     public void testIsWrapperReturnsTrue()
         throws SQLException {
-        assertTrue(con.isWrapperFor(Connection.class));
+        assertTrue(getConnection().isWrapperFor(Connection.class));
     }
 
     public void testSetClientInfoProperties()
         throws SQLException {
-        con.setClientInfo(null);
+        getConnection().setClientInfo(null);
         Properties p = new Properties();
-        con.setClientInfo(p);
+        getConnection().setClientInfo(p);
 
         p.setProperty("prop1", "val1");
         p.setProperty("prop2", "val2");
         try {
-            con.setClientInfo(p);
+            getConnection().setClientInfo(p);
             fail("setClientInfo(String,String) should throw "+
                  "SQLClientInfoException");
         } catch (SQLClientInfoException cie) {
@@ -260,16 +238,16 @@
 
     public void testSetClientInfoString()
         throws SQLException {
-        con.setClientInfo(null, null);
+        getConnection().setClientInfo(null, null);
 
         try {
-            con.setClientInfo("foo", null);
+            getConnection().setClientInfo("foo", null);
             fail("setClientInfo(String, null) should throw "+
                  "NullPointerException");
         } catch (NullPointerException npe) {}
 
         try {
-            con.setClientInfo("name", "value");
+            getConnection().setClientInfo("name", "value");
             fail("setClientInfo(String,String) should throw "+
                  "SQLClientInfoException");
         } catch (SQLClientInfoException cie) {
@@ -285,14 +263,14 @@
     
     public void testUnwrapValid()
         throws SQLException {
-        Connection unwrappedCon = con.unwrap(Connection.class);
-        assertSame("Unwrap returned wrong object.", con, unwrappedCon);
+        Connection unwrappedCon = getConnection().unwrap(Connection.class);
+        assertSame("Unwrap returned wrong object.", getConnection(), unwrappedCon);
     }
 
     public void testUnwrapInvalid()
         throws SQLException {
         try {
-            ResultSet unwrappedRs = con.unwrap(ResultSet.class);
+            ResultSet unwrappedRs = getConnection().unwrap(ResultSet.class);
             fail("unwrap should have thrown an exception");
         } catch (SQLException sqle) {
             assertSQLState("Incorrect SQL state when unable to unwrap",

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/JDBC40TranslationTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/JDBC40TranslationTest.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/JDBC40TranslationTest.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/JDBC40TranslationTest.java Fri Aug 25 13:02:02 2006
@@ -23,13 +23,14 @@
 import java.sql.Types;
 import org.apache.derby.shared.common.reference.JDBC40Translation;
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.BaseTestCase;
 
 /**
  * JUnit test which checks that the constants in JDBC40Translation are
  * correct. Each constant in JDBC40Translation should have a test
  * method comparing it to the value in the java.sql interface.
  */
-public class JDBC40TranslationTest extends BaseJDBCTestCase {
+public class JDBC40TranslationTest extends BaseTestCase {
 
     public JDBC40TranslationTest(String name) {
         super(name);

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ParameterMetaDataWrapperTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ParameterMetaDataWrapperTest.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ParameterMetaDataWrapperTest.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ParameterMetaDataWrapperTest.java Fri Aug 25 13:02:02 2006
@@ -31,12 +31,10 @@
  */
 public class ParameterMetaDataWrapperTest extends BaseJDBCTestCase {
     
-    //Default Connection used by the tests
-    Connection conn = null;
     //Default PreparedStatement used by the tests
-    PreparedStatement ps = null;
+    private PreparedStatement ps = null;
     //Default ParameterMetaData object used by the tests
-    ParameterMetaData pmd = null;
+    private ParameterMetaData pmd = null;
     
     /**
      * Create a test with the given name
@@ -53,10 +51,9 @@
      * @throws SQLException if creation of connection or callable statement
      *                      fail.
      */
-    public void setUp() 
+    protected void setUp() 
         throws SQLException {
-        conn = getConnection();
-        ps   = conn.prepareStatement("values 1");
+        ps   = prepareStatement("values 1");
         pmd  = ps.getParameterMetaData();
     }
 
@@ -66,12 +63,12 @@
      * @throws SQLException if closing of the connection or the callable
      *                      statement fail.
      */
-    public void tearDown()
-        throws SQLException {
+    protected void tearDown()
+        throws Exception {
         if(ps != null && !ps.isClosed())
             ps.close();
-        if(conn != null && !conn.isClosed())
-            conn.close();
+        
+        super.tearDown();
     }
 
     public void testIsWrapperForParameterMetaData() throws SQLException {

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/PreparedStatementTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/PreparedStatementTest.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/PreparedStatementTest.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/PreparedStatementTest.java Fri Aug 25 13:02:02 2006
@@ -45,11 +45,10 @@
      * Default connection and prepared statements that are used by the tests.
      */
     //Connection object
-    Connection conn      = null;
     //PreparedStatement object
-    PreparedStatement ps = null;
+    private PreparedStatement ps = null;
     //Statement object
-    Statement s = null;
+    private Statement s = null;
 
     
     /**
@@ -70,14 +69,13 @@
      */
     public void setUp() 
         throws SQLException {
-        conn = getConnection();
-        //create the statement object
-        s = conn.createStatement();
+       //create the statement object
+        s = createStatement();
         //Create the PreparedStatement that will then be used as the basis 
         //throughout this test henceforth
         //This prepared statement will however NOT be used for testing
         //setClob and setBlob
-        ps = conn.prepareStatement("select count(*) from sys.systables");
+        ps = prepareStatement("select count(*) from sys.systables");
         
          // STEP1: create the tables
          // Structure of table
@@ -97,17 +95,13 @@
      *
      */
     public void tearDown() 
-        throws SQLException {
+        throws Exception {
         
         s.execute("drop table ClobTestTable");
         s.execute("drop table BlobTestTable");
         s.close();
         
-        if (conn != null && !conn.isClosed()) {
-            conn.rollback();
-            conn.close();
-        }
-        conn = null;
+        super.tearDown();
     }
 
     public static Test suite() {
@@ -327,7 +321,7 @@
         StringReader is = new StringReader("Test data for the Clob object");
         is.reset();
         
-        PreparedStatement ps_sc = conn.prepareStatement("insert into ClobTestTable values(?,?)");
+        PreparedStatement ps_sc = prepareStatement("insert into ClobTestTable values(?,?)");
         
         //initially insert the data
         ps_sc.setInt(1,1);
@@ -369,7 +363,7 @@
         // Insert test data.
         String testString = "Test string for setCharacterStream\u1A00";
         Reader reader = new StringReader(testString);
-        PreparedStatement psChar = conn.prepareStatement(
+        PreparedStatement psChar = prepareStatement(
                 "insert into ClobTestTable values (?,?)");
         psChar.setInt(1, 1);
         psChar.setCharacterStream(2, reader);
@@ -409,7 +403,7 @@
         InputStream is = new java.io.ByteArrayInputStream(BYTES);
         is.reset();
         
-        PreparedStatement ps_sb = conn.prepareStatement("insert into BlobTestTable values(?,?)");
+        PreparedStatement ps_sb = prepareStatement("insert into BlobTestTable values(?,?)");
         
         //initially insert the data
         ps_sb.setInt(1,1);
@@ -450,7 +444,7 @@
             throws IOException, SQLException {
         // Insert test data.
         InputStream is = new ByteArrayInputStream(BYTES);
-        PreparedStatement psByte = conn.prepareStatement(
+        PreparedStatement psByte = prepareStatement(
                 "insert into BlobTestTable values (?,?)");
         psByte.setInt(1, 1);
         psByte.setBinaryStream(2, is);
@@ -553,7 +547,7 @@
         
         is.reset();
         
-        PreparedStatement ps_sc = conn.prepareStatement("insert into ClobTestTable values(?,?)");
+        PreparedStatement ps_sc = prepareStatement("insert into ClobTestTable values(?,?)");
         
         //initially insert the data
         ps_sc.setInt(1,1);
@@ -577,7 +571,7 @@
         // Insert test data.
         String testString = "Test string for setCharacterStream\u1A00";
         Reader reader = new StringReader(testString);
-        PreparedStatement psChar = conn.prepareStatement(
+        PreparedStatement psChar = prepareStatement(
                 "insert into ClobTestTable values (?,?)");
         psChar.setInt(1, 1);
         psChar.setCharacterStream(2, reader);
@@ -612,7 +606,7 @@
         
         is.reset();
         
-        PreparedStatement ps_sb = conn.prepareStatement("insert into ClobTestTable values(?,?)");
+        PreparedStatement ps_sb = prepareStatement("insert into ClobTestTable values(?,?)");
         
         //initially insert the data
         ps_sb.setInt(1,1);
@@ -641,7 +635,7 @@
             throws IOException, SQLException {
         // Insert test data.
         InputStream is = new ByteArrayInputStream(BYTES);
-        PreparedStatement psAscii = conn.prepareStatement(
+        PreparedStatement psAscii = prepareStatement(
                 "insert into ClobTestTable values (?,?)");
         psAscii.setInt(1, 1);
         psAscii.setAsciiStream(2, is);
@@ -686,7 +680,7 @@
         
         is.reset();
         
-        PreparedStatement ps_sb = conn.prepareStatement("insert into BlobTestTable values(?,?)");
+        PreparedStatement ps_sb = prepareStatement("insert into BlobTestTable values(?,?)");
         
         //initially insert the data
         ps_sb.setInt(1,1);
@@ -716,7 +710,7 @@
             throws IOException, SQLException {
         // Insert test data.
         InputStream is = new ByteArrayInputStream(BYTES);
-        PreparedStatement psBinary = conn.prepareStatement(
+        PreparedStatement psBinary = prepareStatement(
                 "insert into BlobTestTable values (?,?)");
         psBinary.setInt(1, 1);
         psBinary.setBinaryStream(2, is);

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ResultSetMetaDataTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ResultSetMetaDataTest.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ResultSetMetaDataTest.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ResultSetMetaDataTest.java Fri Aug 25 13:02:02 2006
@@ -31,7 +31,7 @@
 
 public class ResultSetMetaDataTest extends BaseJDBCTestCase {
     //classes that will be used for the test
-    private Connection        conn =null;
+
     private PreparedStatement ps   =null;
     private ResultSet         rs   =null;
     //The ResultSetMetaData object that will be used throughout the test
@@ -51,9 +51,8 @@
     /**
      * Create a default DataSource
      */
-    public void setUp() throws SQLException {
-        conn =   getConnection();
-        ps   =   conn.prepareStatement("select count(*) from sys.systables");
+    protected void setUp() throws SQLException {
+         ps   =   prepareStatement("select count(*) from sys.systables");
 	rs   =   ps.executeQuery();
         rsmd =   rs.getMetaData();
     }
@@ -63,15 +62,14 @@
      * Initialize the ds to null once the tests that need to be run have been 
      * run
      */
-    public void tearDown() throws SQLException {
+    protected void tearDown() throws Exception {
         if(rs != null && !rs.isClosed())
             rs.close();
         if(ps != null && !ps.isClosed())
             ps.close();
-        if(conn != null && !conn.isClosed()) {
-            conn.rollback();
-            conn.close();
-        }
+        
+        super.tearDown();
+
     }
 
     public void testIsWrapperForResultSetMetaData() throws SQLException {

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ResultSetTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ResultSetTest.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ResultSetTest.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ResultSetTest.java Fri Aug 25 13:02:02 2006
@@ -26,6 +26,7 @@
 import junit.framework.*;
 
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.BaseJDBCTestSetup;
 
 import java.io.*;
 import java.sql.*;
@@ -56,8 +57,6 @@
      **/
     private static int insertKey = 0;
 
-    /** Default connection used by the tests. */
-    private Connection con = null;
     /** Statement used to obtain default resultset. */
     private Statement stmt = null;
     /** Default resultset used by the tests. */
@@ -74,11 +73,10 @@
         super(name);
     }
 
-    public void setUp()
+    protected void setUp()
         throws SQLException {
         key = requestKey();
-        con = getConnection();
-        stmt = con.createStatement(ResultSet.TYPE_FORWARD_ONLY,
+        stmt = createStatement(ResultSet.TYPE_FORWARD_ONLY,
                 ResultSet.CONCUR_UPDATABLE);
 
         rs = stmt.executeQuery("SELECT * FROM SYS.SYSTABLES");
@@ -87,8 +85,8 @@
         rs.next();
     }
 
-    public void tearDown()
-        throws SQLException {
+    protected void tearDown()
+        throws Exception {
 
         if (rs != null) {
             rs.close();
@@ -96,10 +94,8 @@
         if (stmt != null) {
             stmt.close();
         }
-        if (con != null && !con.isClosed()) {
-            con.rollback();
-            con.close();
-        }
+
+        super.tearDown();
     }
 
     public void testGetNCharacterStreamIntNotImplemented()
@@ -346,7 +342,7 @@
                 java.io.ByteArrayInputStream(BYTES2);
 
         //Prepared Statement used to insert the data
-        PreparedStatement ps_sb = prep(con, "dLongBit");
+        PreparedStatement ps_sb = prep("dLongBit");
         ps_sb.setInt(1,key);
         ps_sb.setBinaryStream(2,is,BYTES1.length);
         ps_sb.executeUpdate();
@@ -356,7 +352,7 @@
         //use a different ResultSet variable so that the
         //other tests can go on unimpacted
 
-        ResultSet rs1 = fetchUpd(con, "dLongBit", key);
+        ResultSet rs1 = fetchUpd("dLongBit", key);
         rs1.next();
         rs1.updateBinaryStream(1,is_for_update,(int)BYTES2.length);
         rs1.updateRow();
@@ -366,7 +362,7 @@
         //using the updateBinaryStream method is the same
         //data that we expected
 
-        rs1 = fetch(con, "dLongBit", key);
+        rs1 = fetch("dLongBit", key);
         rs1.next();
         InputStream is_ret = rs1.getBinaryStream(1);
 
@@ -408,7 +404,7 @@
                 java.io.ByteArrayInputStream(BYTES2);
 
         //Prepared Statement used to insert the data
-        PreparedStatement ps_sb = con.prepareStatement
+        PreparedStatement ps_sb = prepareStatement
                 ("insert into UpdateTestTable_ResultSet values(?,?)");
         ps_sb.setInt(1,1);
         ps_sb.setAsciiStream(2,is,BYTES1.length);
@@ -463,7 +459,7 @@
                 (str_for_update);
 
         //Prepared Statement used to insert the data
-        PreparedStatement ps_sb = prep(con, "dLongVarchar"); 
+        PreparedStatement ps_sb = prep("dLongVarchar"); 
         ps_sb.setInt(1,key);
         ps_sb.setCharacterStream(2,r,str.length());
         ps_sb.executeUpdate();
@@ -472,7 +468,7 @@
         //Update operation
         //use a different ResultSet variable so that the
         //other tests can go on unimpacted
-        ResultSet rs1 = fetchUpd(con, "dLongVarchar", key);
+        ResultSet rs1 = fetchUpd("dLongVarchar", key);
         rs1.next();
         rs1.updateCharacterStream(1,r_for_update,str_for_update.length());
         rs1.updateRow();
@@ -482,7 +478,7 @@
         //using the updateAsciiStream method is the same
         //data that we expected
 
-        rs1 = fetch(con, "dLongVarchar", key); 
+        rs1 = fetch("dLongVarchar", key); 
         rs1.next();
 
         StringReader r_ret = (StringReader)rs1.getCharacterStream(1);
@@ -525,7 +521,7 @@
                 java.io.ByteArrayInputStream(BYTES2);
 
         //Prepared Statement used to insert the data
-        PreparedStatement ps_sb = prep(con, "dLongBit");
+        PreparedStatement ps_sb = prep("dLongBit");
         ps_sb.setInt(1, key);
         ps_sb.setBinaryStream(2,is,BYTES1.length);
         ps_sb.executeUpdate();
@@ -536,7 +532,7 @@
         //use a different ResultSet variable so that the
         //other tests can go on unimpacted
 
-        ResultSet rs1 = fetchUpd(con, "dLongBit", key);
+        ResultSet rs1 = fetchUpd("dLongBit", key);
         rs1.next();
         rs1.updateBinaryStream("dLongBit",is_for_update,(int)BYTES2.length);
         rs1.updateRow();
@@ -546,7 +542,7 @@
         //using the updateBinaryStream method is the same
         //data that we expected
 
-        rs1 = fetch(con, "dLongBit", key);
+        rs1 = fetch("dLongBit", key);
         rs1.next();
         InputStream is_ret = rs1.getBinaryStream(1);
 
@@ -570,14 +566,14 @@
         InputStream is2 = new java.io.ByteArrayInputStream(BYTES2);
 
         //Prepared Statement used to insert the data
-        PreparedStatement ps_sb = prep(con, "dLongBit");
+        PreparedStatement ps_sb = prep("dLongBit");
         ps_sb.setInt(1, key);
         ps_sb.setBinaryStream(2, is1);
         ps_sb.executeUpdate();
         ps_sb.close();
 
         //Update operation
-        ResultSet rs1 = fetchUpd(con, "dLongBit", key);
+        ResultSet rs1 = fetchUpd("dLongBit", key);
         rs1.next();
         rs1.updateBinaryStream(1, is2);
         rs1.updateRow();
@@ -587,7 +583,7 @@
         //using the updateBinaryStream method is the same
         //data that we expected
 
-        rs1 = fetch(con, "dLongBit", key);
+        rs1 = fetch("dLongBit", key);
         rs1.next();
         assertEquals(new ByteArrayInputStream(BYTES2), rs1.getBinaryStream(1));
         rs1.close();
@@ -604,14 +600,14 @@
         InputStream is2 = new java.io.ByteArrayInputStream(BYTES2);
 
         //Prepared Statement used to insert the data
-        PreparedStatement ps_sb = prep(con, "dBlob");
+        PreparedStatement ps_sb = prep("dBlob");
         ps_sb.setInt(1, key);
         ps_sb.setBinaryStream(2, is1);
         ps_sb.executeUpdate();
         ps_sb.close();
 
         //Update operation
-        ResultSet rs1 = fetchUpd(con, "dBlob", key);
+        ResultSet rs1 = fetchUpd("dBlob", key);
         rs1.next();
         rs1.updateBinaryStream(1, is2);
         rs1.updateRow();
@@ -621,7 +617,7 @@
         //using the updateBinaryStream method is the same
         //data that we expected
 
-        rs1 = fetch(con, "dBlob", key);
+        rs1 = fetch("dBlob", key);
         rs1.next();
         assertEquals(new ByteArrayInputStream(BYTES2), rs1.getBinaryStream(1));
         rs1.close();
@@ -634,14 +630,14 @@
         InputStream is2 = new java.io.ByteArrayInputStream(BYTES2);
 
         //Prepared Statement used to insert the data
-        PreparedStatement ps_sb = prep(con, "dLongBit");
+        PreparedStatement ps_sb = prep("dLongBit");
         ps_sb.setInt(1, key);
         ps_sb.setBinaryStream(2, is1);
         ps_sb.executeUpdate();
         ps_sb.close();
 
         //Update operation
-        ResultSet rs1 = fetchUpd(con, "dLongBit", key);
+        ResultSet rs1 = fetchUpd("dLongBit", key);
         rs1.next();
         rs1.updateBinaryStream("dLongBit", is2);
         rs1.updateRow();
@@ -651,7 +647,7 @@
         //using the updateBinaryStream method is the same
         //data that we expected
 
-        rs1 = fetch(con, "dLongBit", key);
+        rs1 = fetch("dLongBit", key);
         rs1.next();
         assertEquals(new ByteArrayInputStream(BYTES2), rs1.getBinaryStream(1));
         rs1.close();
@@ -682,7 +678,7 @@
                 java.io.ByteArrayInputStream(BYTES2);
 
         //Prepared Statement used to insert the data
-        PreparedStatement ps_sb = prep(con, "dLongVarchar");
+        PreparedStatement ps_sb = prep("dLongVarchar");
         ps_sb.setInt(1, key);
         ps_sb.setAsciiStream(2,is,BYTES1.length);
         ps_sb.executeUpdate();
@@ -692,7 +688,7 @@
         //use a different ResultSet variable so that the
         //other tests can go on unimpacted
 
-        ResultSet rs1 = fetchUpd(con, "dLongVarchar", key);
+        ResultSet rs1 = fetchUpd("dLongVarchar", key);
         rs1.next();
         rs1.updateAsciiStream("dLongVarchar",is_for_update,(int)BYTES2.length);
         rs1.updateRow();
@@ -702,7 +698,7 @@
         //using the updateAsciiStream method is the same
         //data that we expected
 
-        rs1 = fetch(con, "dLongVarchar", key);
+        rs1 = fetch("dLongVarchar", key);
         rs1.next();
         InputStream is_ret = rs1.getAsciiStream(1);
 
@@ -728,21 +724,21 @@
                 java.io.ByteArrayInputStream(BYTES2);
 
         // Prepared Statement used to insert the data.
-        PreparedStatement ps_sb = prep(con, "dLongVarchar");
+        PreparedStatement ps_sb = prep("dLongVarchar");
         ps_sb.setInt(1, key);
         ps_sb.setAsciiStream(2, is, BYTES1.length);
         ps_sb.executeUpdate();
         ps_sb.close();
 
         // Update the data.
-        ResultSet rs1 = fetchUpd(con, "dLongVarchar", key);
+        ResultSet rs1 = fetchUpd("dLongVarchar", key);
         rs1.next();
         rs1.updateAsciiStream(1, isForUpdate);
         rs1.updateRow();
         rs1.close();
 
         // Query to see whether the data that has been updated.
-        rs1 = fetch(con, "dLongVarchar", key);
+        rs1 = fetch("dLongVarchar", key);
         rs1.next();
         InputStream isRet = rs1.getAsciiStream(1);
         isRet.read(bytesRet);
@@ -767,21 +763,21 @@
                 java.io.ByteArrayInputStream(BYTES2);
 
         // Prepared Statement used to insert the data.
-        PreparedStatement ps_sb = prep(con, "dLongVarchar");
+        PreparedStatement ps_sb = prep("dLongVarchar");
         ps_sb.setInt(1, key);
         ps_sb.setAsciiStream(2, is, BYTES1.length);
         ps_sb.executeUpdate();
         ps_sb.close();
 
         // Update the data.
-        ResultSet rs1 = fetchUpd(con, "dLongVarchar", key);
+        ResultSet rs1 = fetchUpd("dLongVarchar", key);
         rs1.next();
         rs1.updateAsciiStream("dLongVarchar", isForUpdate);
         rs1.updateRow();
         rs1.close();
 
         // Query to see whether the data that has been updated.
-        rs1 = fetch(con, "dLongVarchar", key);
+        rs1 = fetch("dLongVarchar", key);
         rs1.next();
         InputStream isRet = rs1.getAsciiStream(1);
         isRet.read(bytesRet);
@@ -810,7 +806,7 @@
                 (str_for_update);
 
         //Prepared Statement used to insert the data
-        PreparedStatement ps_sb = prep(con, "dLongVarchar");
+        PreparedStatement ps_sb = prep("dLongVarchar");
         ps_sb.setInt(1, key);
         ps_sb.setCharacterStream(2,r,str.length());
         ps_sb.executeUpdate();
@@ -819,7 +815,7 @@
         //Update operation
         //use a different ResultSet variable so that the
         //other tests can go on unimpacted
-        ResultSet rs1 = fetchUpd(con, "dLongVarchar", key);
+        ResultSet rs1 = fetchUpd("dLongVarchar", key);
         rs1.next();
         rs1.updateCharacterStream("dLongVarchar", 
                                   r_for_update,
@@ -831,7 +827,7 @@
         //using the updateAsciiStream method is the same
         //data that we expected
 
-        rs1 = fetch(con, "dLongVarchar", key);
+        rs1 = fetch("dLongVarchar", key);
         rs1.next();
 
         StringReader r_ret = (StringReader)rs1.getCharacterStream(1);
@@ -854,21 +850,21 @@
         String strUpdated = "An updated (\u0FEF\u9876) test string";
 
         // Insert test data
-        PreparedStatement psChar = prep(con, "dLongVarchar");
+        PreparedStatement psChar = prep("dLongVarchar");
         psChar.setInt(1, key);
         psChar.setCharacterStream(2, new StringReader(str));
         psChar.execute();
         psChar.close();
 
         // Update test data
-        ResultSet rs = fetchUpd(con, "dLongVarchar", key);
+        ResultSet rs = fetchUpd("dLongVarchar", key);
         rs.next();
         rs.updateCharacterStream(1, new StringReader(strUpdated));
         rs.updateRow();
         rs.close();
 
         // Verify that update took place and is correct.
-        rs = fetch(con, "dLongVarchar", key);
+        rs = fetch("dLongVarchar", key);
         rs.next();
         Reader updatedStr = rs.getCharacterStream(1);
         for (int i=0; i < strUpdated.length(); i++) {
@@ -886,21 +882,21 @@
         String strUpdated = "An updated (\u0FEF\u9876) test string";
 
         // Insert test data
-        PreparedStatement psChar = prep(con, "dLongVarchar");
+        PreparedStatement psChar = prep("dLongVarchar");
         psChar.setInt(1, key);
         psChar.setCharacterStream(2, new StringReader(str));
         psChar.execute();
         psChar.close();
 
         // Update test data
-        ResultSet rs = fetchUpd(con, "dLongVarchar", key);
+        ResultSet rs = fetchUpd("dLongVarchar", key);
         rs.next();
         rs.updateCharacterStream("dLongVarchar", new StringReader(strUpdated));
         rs.updateRow();
         rs.close();
 
         // Verify that update took place and is correct.
-        rs = fetch(con, "dLongVarchar", key);
+        rs = fetch("dLongVarchar", key);
         rs.next();
         Reader updatedStr = rs.getCharacterStream(1);
         for (int i=0; i < strUpdated.length(); i++) {
@@ -935,7 +931,7 @@
         InputStream is2 = new java.io.ByteArrayInputStream(BYTES2);
 
         //Prepared Statement used to insert the data
-        PreparedStatement ps_sb = prep(con, "dClob");
+        PreparedStatement ps_sb = prep("dClob");
 
         //first insert
         ps_sb.setInt(1,key);
@@ -958,12 +954,12 @@
         //update the second result set with this
         //Clob value
 
-        ResultSet rs1 = fetchUpd(con, "dClob", key);
+        ResultSet rs1 = fetchUpd("dClob", key);
         rs1.next();
         Clob clob = rs1.getClob(1);
         rs1.close();
 
-        rs1 = fetchUpd(con, "dClob", key2);
+        rs1 = fetchUpd("dClob", key2);
         rs1.next();
         rs1.updateClob(1,clob);
         rs1.updateRow();
@@ -973,7 +969,7 @@
         //using the updateClob method is the same
         //data that we expected
 
-        rs1 = fetch(con, "dClob", key2);
+        rs1 = fetch("dClob", key2);
         rs1.next();
         assertEquals(clob, rs1.getClob(1));
         rs1.close();
@@ -986,21 +982,21 @@
         Reader r2 = new java.io.StringReader(new String(BYTES2));
 
         // Prepared Statement used to insert the data
-        PreparedStatement ps_sb = prep(con, "dClob");
+        PreparedStatement ps_sb = prep("dClob");
         ps_sb.setInt(1, key);
         ps_sb.setCharacterStream(2, r1);
         ps_sb.executeUpdate();
         ps_sb.close();
 
         // Update operation
-        ResultSet rs1 = fetchUpd(con, "dClob", key);
+        ResultSet rs1 = fetchUpd("dClob", key);
         rs1.next();
         rs1.updateClob(1, r2);
         rs1.updateRow();
         rs1.close();
 
         // Query to see whether the data that has been updated.
-        rs1 = fetch(con, "dClob", key);
+        rs1 = fetch("dClob", key);
         rs1.next();
         assertEquals(new StringReader(new String(BYTES2)),
                      rs1.getCharacterStream(1));
@@ -1030,7 +1026,7 @@
         InputStream is2 = new java.io.ByteArrayInputStream(BYTES2);
 
         //Prepared Statement used to insert the data
-        PreparedStatement ps_sb = prep(con, "dBlob");
+        PreparedStatement ps_sb = prep("dBlob");
 
         //first insert
         ps_sb.setInt(1, key);
@@ -1053,12 +1049,12 @@
         //update the second result set with this
         //Clob value
 
-        ResultSet rs1 = fetch(con, "dBlob", key);
+        ResultSet rs1 = fetch("dBlob", key);
         rs1.next();
         Blob blob = rs1.getBlob(1);
         rs1.close();
 
-        rs1 = fetchUpd(con, "dBlob", key2);
+        rs1 = fetchUpd("dBlob", key2);
         rs1.next();
         rs1.updateBlob(1,blob);
         rs1.updateRow();
@@ -1068,7 +1064,7 @@
         //using the updateBlob method is the same
         //data that we expected
 
-        rs1 = fetch(con, "dBlob", key2);
+        rs1 = fetch("dBlob", key2);
         rs1.next();
         assertEquals(blob, rs1.getBlob(1));
         rs1.close();
@@ -1081,21 +1077,21 @@
         InputStream is2 = new java.io.ByteArrayInputStream(BYTES2);
 
         // Prepared Statement used to insert the data
-        PreparedStatement ps_sb = prep(con, "dBlob");
+        PreparedStatement ps_sb = prep("dBlob");
         ps_sb.setInt(1, key);
         ps_sb.setBinaryStream(2, is1);
         ps_sb.executeUpdate();
         ps_sb.close();
 
         // Update operation
-        ResultSet rs1 = fetchUpd(con, "dBlob", key);
+        ResultSet rs1 = fetchUpd("dBlob", key);
         rs1.next();
         rs1.updateBlob(1, is2);
         rs1.updateRow();
         rs1.close();
 
         // Query to see whether the data that has been updated.
-        rs1 = fetch(con, "dBlob", key);
+        rs1 = fetch("dBlob", key);
         rs1.next();
         assertEquals(new ByteArrayInputStream(BYTES2), rs1.getBinaryStream(1));
         rs1.close();
@@ -1124,7 +1120,7 @@
         InputStream is2 = new java.io.ByteArrayInputStream(BYTES2);
 
         //Prepared Statement used to insert the data
-        PreparedStatement ps_sb = prep(con, "dClob");
+        PreparedStatement ps_sb = prep("dClob");
 
         //first insert
         ps_sb.setInt(1, key);
@@ -1147,12 +1143,12 @@
         //update the second result set with this
         //Clob value
 
-        ResultSet rs1 = fetch(con, "dClob", key);
+        ResultSet rs1 = fetch("dClob", key);
         rs1.next();
         Clob clob = rs1.getClob(1);
         rs1.close();
 
-        rs1 = fetchUpd(con, "dClob", key2);
+        rs1 = fetchUpd("dClob", key2);
         rs1.next();
         rs1.updateClob("dClob",clob);
         rs1.updateRow();
@@ -1162,7 +1158,7 @@
         //using the updateClob method is the same
         //data that we expected
 
-        rs1 = fetch(con, "dClob", key2);
+        rs1 = fetch("dClob", key2);
         rs1.next();
         assertEquals(clob, rs1.getClob(1));
         rs1.close();
@@ -1175,21 +1171,21 @@
         Reader r2 = new java.io.StringReader(new String(BYTES2));
 
         // Prepared Statement used to insert the data
-        PreparedStatement ps_sb = prep(con, "dClob");
+        PreparedStatement ps_sb = prep("dClob");
         ps_sb.setInt(1, key);
         ps_sb.setCharacterStream(2, r1);
         ps_sb.executeUpdate();
         ps_sb.close();
 
         // Update operation
-        ResultSet rs1 = fetchUpd(con, "dClob", key);
+        ResultSet rs1 = fetchUpd("dClob", key);
         rs1.next();
         rs1.updateClob("dClob", r2);
         rs1.updateRow();
         rs1.close();
 
         // Query to see whether the data that has been updated.
-        rs1 = fetch(con, "dClob", key);
+        rs1 = fetch("dClob", key);
         rs1.next();
         assertEquals(new StringReader(new String(BYTES2)),
                      rs1.getCharacterStream(1));
@@ -1219,7 +1215,7 @@
         InputStream is2 = new java.io.ByteArrayInputStream(BYTES2);
 
         //Prepared Statement used to insert the data
-        PreparedStatement ps_sb = prep(con, "dBlob");
+        PreparedStatement ps_sb = prep("dBlob");
 
         //first insert
         ps_sb.setInt(1, key);
@@ -1242,12 +1238,12 @@
         //update the second result set with this
         //Clob value
 
-        ResultSet rs1 = fetch(con, "dBlob", key);
+        ResultSet rs1 = fetch("dBlob", key);
         rs1.next();
         Blob blob = rs1.getBlob(1);
         rs1.close();
 
-        rs1 = fetchUpd(con, "dBlob", key2);
+        rs1 = fetchUpd("dBlob", key2);
         rs1.next();
         rs1.updateBlob("dBlob",blob);
         rs1.updateRow();
@@ -1257,7 +1253,7 @@
         //using the updateBlob method is the same
         //data that we expected
 
-        rs1 = fetch(con, "dBlob", key2);
+        rs1 = fetch("dBlob", key2);
         rs1.next();
         assertEquals(blob, rs1.getBlob(1)); 
         rs1.close();
@@ -1270,21 +1266,21 @@
         InputStream is2 = new java.io.ByteArrayInputStream(BYTES2);
 
         // Prepared Statement used to insert the data
-        PreparedStatement ps_sb = prep(con, "dBlob");
+        PreparedStatement ps_sb = prep("dBlob");
         ps_sb.setInt(1, key);
         ps_sb.setBinaryStream(2, is1);
         ps_sb.executeUpdate();
         ps_sb.close();
 
         // Update operation
-        ResultSet rs1 = fetchUpd(con, "dBlob", key);
+        ResultSet rs1 = fetchUpd("dBlob", key);
         rs1.next();
         rs1.updateBlob("dBlob", is2);
         rs1.updateRow();
         rs1.close();
 
         // Query to see whether the data that has been updated.
-        rs1 = fetch(con, "dBlob", key);
+        rs1 = fetch("dBlob", key);
         rs1.next();
         assertEquals(new ByteArrayInputStream(BYTES2), rs1.getBinaryStream(1));
         rs1.close();
@@ -1331,50 +1327,31 @@
                     embeddedSuite("ResultSetTest embedded-only suite"));
         }
         // Wrap suite in a TestSetup-class.
-        return new TestSetup(rsSuite) {
-                public void setUp()
-                        throws SQLException {
-                    oneTimeSetup();
-                }
-
-                public void tearDown()
+        return new BaseJDBCTestSetup(rsSuite) {
+                protected void setUp()
                         throws SQLException {
-                    oneTimeTearDown();
+                    Connection con = getConnection();
+                    Statement stmt = con.createStatement();
+                    stmt.execute("create table UpdateTestTableResultSet (" +
+                            "sno int not null unique," +
+                            "dBlob BLOB," +
+                            "dClob CLOB," +
+                            "dLongVarchar LONG VARCHAR," +
+                            "dLongBit LONG VARCHAR FOR BIT DATA)");
+                    stmt.close();
+               }
+
+                protected void tearDown()
+                        throws Exception {
+                    Connection con = getConnection();
+                    Statement stmt = con.createStatement();
+                    stmt.execute("drop table UpdateTestTableResultSet");
+                    stmt.close();
+                    super.tearDown();
                 }
             };
     }
 
-    /**
-     * Perform one-time setup for the suite.
-     * Creates the necessary tables for the tests.
-     */
-    protected static void oneTimeSetup()
-            throws SQLException {
-        Connection con = getConnection();
-        Statement stmt = con.createStatement();
-        stmt.execute("create table UpdateTestTableResultSet (" +
-                "sno int not null unique," +
-                "dBlob BLOB," +
-                "dClob CLOB," +
-                "dLongVarchar LONG VARCHAR," +
-                "dLongBit LONG VARCHAR FOR BIT DATA)");
-        stmt.close();
-        con.close();
-    }
-
-    /**
-     * Perform one-time cleanup for the suite.
-     * Deletes the tables used by the tests.
-     */
-    protected static void oneTimeTearDown()
-            throws SQLException {
-        Connection con = getConnection();
-        Statement stmt = con.createStatement();
-        stmt.execute("drop table UpdateTestTableResultSet");
-        stmt.close();
-        con.close();
-    }
-
     /*************************************************************************
      **                    U T I L I T Y  M E T H O D S                      *
      *************************************************************************/
@@ -1396,9 +1373,9 @@
      * @param con connection to database
      * @param colName name of the column to insert into
      */
-    private static PreparedStatement prep(Connection con, String colName)
+    private PreparedStatement prep(String colName)
             throws SQLException {
-        return con.prepareStatement("insert into UpdateTestTableResultSet " +
+        return prepareStatement("insert into UpdateTestTableResultSet " +
                 "(sno, " + colName + ") values (?,?)");
     }
 
@@ -1411,9 +1388,9 @@
      * @return a <code>ResultSet</code> with zero or one row, depending on
      *      the key used
      */
-    private static ResultSet fetchUpd(Connection con, String colName, int key)
+    private ResultSet fetchUpd(String colName, int key)
             throws SQLException {
-        Statement stmt = con.createStatement(ResultSet.TYPE_FORWARD_ONLY,
+        Statement stmt = createStatement(ResultSet.TYPE_FORWARD_ONLY,
                                              ResultSet.CONCUR_UPDATABLE);
         return stmt.executeQuery("select " + colName +
                 " from UpdateTestTableResultSet where sno = " + key +
@@ -1429,9 +1406,9 @@
      * @return a <code>ResultSet</code> with zero or one row, depending on
      *      the key used
      */
-    private static ResultSet fetch(Connection con, String colName, int key)
+    private ResultSet fetch(String colName, int key)
             throws SQLException {
-        Statement stmt = con.createStatement();
+        Statement stmt = createStatement();
         return stmt.executeQuery("select " + colName +
                 " from UpdateTestTableResultSet where sno = " + key);
     }

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/RowIdNotImplementedTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/RowIdNotImplementedTest.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/RowIdNotImplementedTest.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/RowIdNotImplementedTest.java Fri Aug 25 13:02:02 2006
@@ -43,9 +43,6 @@
 public class RowIdNotImplementedTest 
     extends BaseJDBCTestCase {
 
-    /** Default connection used by the tests. */
-    private Connection con = null;
-
     /**
      * Create test with given name.
      *
@@ -55,33 +52,11 @@
         super(name);
     }
     
-    /**
-     * Obtain default connection.
-     *
-     * @throws SQLException if obtaining connection fails.
-     */
-    public void setUp()
-        throws SQLException {
-        con = getConnection();
-    }
-
-    /**
-     * Do rollback and close on connection.
-     *
-     * @throws SQLException if rollback or close fails on connection.
-     */
-    public void tearDown()
-        throws SQLException {
-        if (con != null && !con.isClosed()) {
-            con.rollback();
-            con.close();
-        }
-    }
 
     public void testRowIdInPreparedStatementSetRowId() 
         throws SQLException {
         PreparedStatement pStmt = 
-            con.prepareStatement("select count(*) from sys.systables");
+            prepareStatement("select count(*) from sys.systables");
         try {
             pStmt.setRowId(1, null);
             fail("PreparedStatement.setRowId should not be implemented");
@@ -170,7 +145,7 @@
 
     public void testRowIdInDatabaseMetaDataRowIdLifeTime() 
         throws SQLException {
-        DatabaseMetaData meta = con.getMetaData();
+        DatabaseMetaData meta = getConnection().getMetaData();
         RowIdLifetime rowIdLifetime = meta.getRowIdLifetime();
         assertEquals("RowIdLifetime should be ROWID_UNSUPPORTED",
             RowIdLifetime.ROWID_UNSUPPORTED,
@@ -227,7 +202,7 @@
     private CallableStatement getCallableStatement() 
         throws SQLException {
         // No need to actuall call a stored procedure.
-        return con.prepareCall("values 1");
+        return prepareCall("values 1");
     }
 
     /**
@@ -239,7 +214,7 @@
     private ResultSet getResultSet()
         throws SQLException {
         // Create a very simple resultset.
-        return con.createStatement().executeQuery("values 1");
+        return createStatement().executeQuery("values 1");
     }
     
     /**

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/SetObjectUnsupportedTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/SetObjectUnsupportedTest.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/SetObjectUnsupportedTest.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/SetObjectUnsupportedTest.java Fri Aug 25 13:02:02 2006
@@ -76,8 +76,7 @@
      */
     private PreparedStatement prepare() throws SQLException {
         String sql = "values (CAST (? AS VARCHAR(128)))";
-        Connection c = getConnection();
-        return callable ? c.prepareCall(sql) : c.prepareStatement(sql);
+        return callable ? prepareCall(sql) : prepareStatement(sql);
     }
 
     /**

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTest.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTest.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTest.java Fri Aug 25 13:02:02 2006
@@ -33,9 +33,7 @@
 public class StatementTest
     extends BaseJDBCTestCase {
 
-    /** Default connection used by the tests. */
-    private Connection con = null;
-    /** Default statement used by the tests. */
+   /** Default statement used by the tests. */
     private Statement stmt = null;
     
     /**
@@ -53,13 +51,11 @@
      * @throws SQLException if setAutoCommit, createStatement or 
      *                      BaseJDBCTestCase.getConnection fails.
      */
-    public void setUp() 
+    protected void setUp() 
         throws SQLException {
-        con = getConnection();
-        assertFalse("Connection must be open initially", con.isClosed());
-        con.setAutoCommit(false);
+        getConnection().setAutoCommit(false);
         // Create a default statement.
-        stmt = con.createStatement();
+        stmt = createStatement();
         assertFalse("First statement must be open initially", 
                 stmt.isClosed());
     }
@@ -69,20 +65,14 @@
      *
      * @throws SQLException if a database access exception occurs.
      */
-    public void tearDown() 
-        throws SQLException {
+    protected void tearDown() 
+        throws Exception {
         // Close default statement
         if (stmt != null) {
             stmt.close();
         }
-        // Close default connection
-        // Check if connection is open to avoid exception on rollback.
-        if (con != null && !con.isClosed()) {
-            // Abort changes that may have been done in the test.
-            // The test-method may however commit these itself.
-            con.rollback();
-            con.close();
-        }
+
+        super.tearDown();
     }
 
     /**
@@ -108,7 +98,7 @@
     public void testIsClosedWithTwoStatementsOnSameConnection()
         throws SQLException {
         // Create a second statement on the default connection.
-        Statement stmt2 = con.createStatement();
+        Statement stmt2 = createStatement();
         assertFalse("Second statement must be open initially", 
                 stmt2.isClosed());
         assertFalse("First statement should not be closed when " +
@@ -132,7 +122,7 @@
     public void testIsClosedWhenClosingConnection()
         throws SQLException {
         // Create an extra statement for good measure.
-        Statement stmt2 = con.createStatement();
+        Statement stmt2 = createStatement();
         assertFalse("Second statement must be open initially",
                 stmt2.isClosed());
         // Exeute something on it, as opposed to the default statement.
@@ -141,7 +131,8 @@
                 "execute()", stmt2.isClosed());
         // Close the connection. We must commit/rollback first, or else a
         // "Invalid transaction state" exception is raised.
-        con.rollback();
+        rollback();
+        Connection con = getConnection();
         con.close();
         assertTrue("Connection should be closed after close()", 
                 con.isClosed());
@@ -165,6 +156,7 @@
         throws SQLException {
         stmt.executeQuery("select count(*) from stmtTable");
         // Connection should now be in an invalid transaction state.
+        Connection con = stmt.getConnection();
         try {
             con.close();
             fail("Invalid transaction state exception was not thrown");
@@ -207,6 +199,7 @@
      */
     public void testStatementExecuteAfterConnectionClose() 
         throws SQLException {
+        Connection con = stmt.getConnection();
         con.close();
         assertTrue("Connection should be closed after close()", 
                 con.isClosed());

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTestSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTestSetup.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTestSetup.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTestSetup.java Fri Aug 25 13:02:02 2006
@@ -21,6 +21,7 @@
 package org.apache.derbyTesting.functionTests.tests.jdbc4;
 
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.BaseJDBCTestSetup;
 
 import junit.framework.Test;
 import junit.extensions.TestSetup;
@@ -33,7 +34,7 @@
  *  @see StatementTest
  */
 public class StatementTestSetup 
-    extends TestSetup {
+    extends BaseJDBCTestSetup {
 
     /**
      * Initialize database schema.
@@ -52,9 +53,9 @@
      *
      * @see StatementTest
      */
-    public void setUp()
+    protected void setUp()
         throws SQLException {
-        Connection con = BaseJDBCTestCase.getConnection();
+        Connection con = getConnection();
         // Create tables used by the test.
         Statement stmt = con.createStatement();
         // See if the table is already there, and if so, delete it.
@@ -79,7 +80,6 @@
         rs.close();
         stmt.close();
         con.commit();
-        con.close();
     }
 
     /**
@@ -88,14 +88,14 @@
      *
      * @throws SQLException if database operations fail.
      */
-    public void tearDown() 
-        throws SQLException {
-        Connection con = BaseJDBCTestCase.getConnection();
+    protected void tearDown() 
+        throws Exception {
+        Connection con = getConnection();
         Statement stmt = con.createStatement();
         stmt.execute("drop table stmtTable");
         stmt.close();
         con.commit();
-        con.close();
+        super.tearDown();
     }
    
 } // End class StatementTestSetup

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/UnsupportedVetter.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/UnsupportedVetter.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/UnsupportedVetter.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/UnsupportedVetter.java Fri Aug 25 13:02:02 2006
@@ -364,7 +364,7 @@
 	public	void	testSupportedMethods()
 		throws Exception
 	{
-		CONFIG.setVerbosity( true );
+        getTestConfiguration().setVerbosity( true );
 
 		HashSet<String>	vanishedMethodList = new HashSet<String>();
 		HashSet<String>	unsupportedList = new HashSet<String>();
@@ -418,7 +418,8 @@
 	{
 		ConnectionPoolDataSource	ds = TestDataSourceFactory.getConnectionPoolDataSource();
 		PooledConnection			pc = ds.getPooledConnection
-			(CONFIG.getUserName(), CONFIG.getUserPassword());
+			(getTestConfiguration().getUserName(),
+                    getTestConfiguration().getUserPassword());
 		Connection					conn = pc.getConnection();
 
 		vetObject( ds, unsupportedList, notUnderstoodList );
@@ -436,7 +437,8 @@
 	{
 		XADataSource				ds = TestDataSourceFactory.getXADataSource();
 		XAConnection				xaconn = ds.getXAConnection
-			(CONFIG.getUserName(), CONFIG.getUserPassword());
+			(getTestConfiguration().getUserName(),
+                    getTestConfiguration().getUserPassword());
 		Connection					conn = xaconn.getConnection();
 
 		vetObject( ds, unsupportedList, notUnderstoodList );

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/VerifySignatures.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/VerifySignatures.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/VerifySignatures.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/VerifySignatures.java Fri Aug 25 13:02:02 2006
@@ -34,6 +34,7 @@
 import org.apache.derbyTesting.functionTests.util.TestUtil;
 import org.apache.derbyTesting.functionTests.util.TestDataSourceFactory;
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.TestConfiguration;
 
 /**
  * JUnit test which checks that all methods specified by the
@@ -110,7 +111,7 @@
         collectClassesFromConnectionPoolDataSource(classes);
         collectClassesFromXADataSource(classes);
         addClass(classes,
-                 DriverManager.getDriver(CONFIG.getJDBCUrl()).getClass(),
+                 DriverManager.getDriver(TestConfiguration.getCurrent().getJDBCUrl()).getClass(),
                  java.sql.Driver.class);
 
         TestSuite suite = new TestSuite();
@@ -151,8 +152,8 @@
         DataSource ds = TestDataSourceFactory.getDataSource();
         addClass(classes, ds.getClass(), javax.sql.DataSource.class);
         collectClassesFromConnection(ds.getConnection
-                                     (CONFIG.getUserName(),
-                                      CONFIG.getUserPassword()),
+                                     (TestConfiguration.getCurrent().getUserName(),
+                                             TestConfiguration.getCurrent().getUserPassword()),
                                      classes);
     }
 
@@ -173,8 +174,8 @@
                  cpds.getClass(), javax.sql.ConnectionPoolDataSource.class);
 
         PooledConnection pc =
-            cpds.getPooledConnection(CONFIG.getUserName(),
-                                     CONFIG.getUserPassword());
+            cpds.getPooledConnection(TestConfiguration.getCurrent().getUserName(),
+                    TestConfiguration.getCurrent().getUserPassword());
         addClass(classes, pc.getClass(), javax.sql.PooledConnection.class);
 
         collectClassesFromConnection(pc.getConnection(), classes);
@@ -196,8 +197,8 @@
         XADataSource xads = TestDataSourceFactory.getXADataSource();
         addClass(classes, xads.getClass(), javax.sql.XADataSource.class);
 
-        XAConnection xaconn = xads.getXAConnection(CONFIG.getUserName(),
-                                                   CONFIG.getUserPassword());
+        XAConnection xaconn = xads.getXAConnection(TestConfiguration.getCurrent().getUserName(),
+                TestConfiguration.getCurrent().getUserPassword());
         addClass(classes, xaconn.getClass(), javax.sql.XAConnection.class);
 
         collectClassesFromConnection(xaconn.getConnection(), classes);