You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by km...@apache.org on 2006/04/09 19:05:53 UTC

svn commit: r392781 - in /db/derby/code/trunk/java: drda/org/apache/derby/impl/drda/ testing/org/apache/derbyTesting/functionTests/master/DerbyNet/ testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/ testing/org/apache/derbyTesting/fun...

Author: kmarsden
Date: Sun Apr  9 10:05:51 2006
New Revision: 392781

URL: http://svn.apache.org/viewcvs?rev=392781&view=rev
Log:
DERBY-1196 Network server closes prepared statements prematurely if exception occurs during OPNQRY 

- Takes out close of prepared statement on exception in OPNQRY in DRDAConnThread processCommands
- Updates the JCC master for derbnet/setTransactionIsolation.  
  This test was getting Statement already closed errors for valid statements with JCC that are no longer in the master.
- Enables test for DERBY-1047 in checkDataSource ( Note this case actually passes withtout the fix because of the fix for DERBY-1158)



Modified:
    db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/setTransactionIsolation.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/checkDataSource.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java

Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java?rev=392781&r1=392780&r2=392781&view=diff
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java Sun Apr  9 10:05:51 2006
@@ -747,14 +747,10 @@
 					catch (SQLException e)
 					{
 						writer.clearDSSesBackToMark(writerMark);
-						try {
-							// Try to cleanup if we hit an error.
-							if (ps != null)
-								ps.close();
+						// The fix for DERBY-1196 removed code 
+						// here to close the prepared statement 
+						// if OPNQRY failed.
 							writeOPNQFLRM(e);
-						}
-						catch (SQLException pse) {}
-						errorInChain(e);
 					}
 					break;
 				case CodePoint.RDBCMM:

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/setTransactionIsolation.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/setTransactionIsolation.out?rev=392781&r1=392780&r2=392781&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/setTransactionIsolation.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/setTransactionIsolation.out Sun Apr  9 10:05:51 2006
@@ -465,15 +465,15 @@
 con.setTransactionIsolation(TRANSACTION_REAPEATABLE_READ:4)
 con.getTransactionIsolation() =TRANSACTION_REAPEATABLE_READ:4
 select * from t1
-'Statement' already closed.
+A lock could not be obtained within the time requested
 con.setTransactionIsolation(TRANSACTION_READ_COMMITTED:2)
 con.getTransactionIsolation() =TRANSACTION_READ_COMMITTED:2
 select * from t1
-'Statement' already closed.
+A lock could not be obtained within the time requested
 con.setTransactionIsolation(TRANSACTION_SERIALIZABLE:8)
 con.getTransactionIsolation() =TRANSACTION_SERIALIZABLE:8
 select * from t1
-'Statement' already closed.
+A lock could not be obtained within the time requested
 ***testLevelsAndPrintStatistics sql:insert into t1copy (select * from t1) makenewStatements:false
 con.prepareStatement(insert into t1copy (select * from t1))
 con.setTransactionIsolation(TRANSACTION_READ_UNCOMMITTED:1)

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/checkDataSource.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/checkDataSource.out?rev=392781&r1=392780&r2=392781&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/checkDataSource.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/checkDataSource.out Sun Apr  9 10:05:51 2006
@@ -406,9 +406,10 @@
   getFetchSize() 999
   getMaxFieldSize() 137
   getMaxRows() 85
+Params-local-2: ru(SQL_CURLH000C) contents {3}
 LOCK TABLE
   xid row 0 lock count 14
-  xid row 1 lock count 12
+  xid row 1 lock count 14
 END LOCK TABLE
 sru1-local-8: mismatched Statement connection
 sru1-local-8: ru(SQL_CURLH000C) contents {1} {2} {3}

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java?rev=392781&r1=392780&r2=392781&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java Sun Apr  9 10:05:51 2006
@@ -88,11 +88,6 @@
 	// Tests for setting isolation level this way only run in embedded for now.
 	private boolean canSetIsolationWithStatement = TestUtil.isEmbeddedFramework();
 	  
-	
-	// DERBY-1047  wiht client xa a PreparedStatement created before the global 
-	//transaction starts gives java.sql.SQLException: 'Statement' already closed.' 
-	// when used after  the global transaction ends
-	private static boolean canUseStatementAfterXa_end = TestUtil.isEmbeddedFramework();
 	 	
 	// DERBY-1025 client  XAResource.start() does not commit an active local transaction 
 	// when auto commit is true. Embedded XAResource.start() implementation commits 
@@ -467,7 +462,7 @@
 		cs1 = xac.getConnection();
 
     
-		// ensure read locsk stay around until end-of transaction
+		// ensure read locks stay around until end-of transaction
 		cs1.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
 		cs1.setAutoCommit(false);
 
@@ -516,10 +511,7 @@
 		showStatementState("LOCAL ", sruState);
 		showStatementState("PS LOCAL ", psruState);
 		showStatementState("CS LOCAL ", csruState);
-		if (canUseStatementAfterXa_end)
-		{
-			resultSetQuery("Params-local-2", psParams.executeQuery());
-		}
+		resultSetQuery("Params-local-2", psParams.executeQuery());
 		checkLocks(cs1);
 		cs1.commit();