org.apache.derbyTesting.functionTests.tests.jdbcapi
Class ResultSetCloseTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.derbyTesting.junit.BaseTestCase
              extended by org.apache.derbyTesting.junit.BaseJDBCTestCase
                  extended by org.apache.derbyTesting.functionTests.tests.jdbcapi.ResultSetCloseTest
All Implemented Interfaces:
junit.framework.Test

public class ResultSetCloseTest
extends BaseJDBCTestCase

This class is used to test the fix for DERBY-694. A brief description of DERBY-694 (Got from the description in JIRA) 1) Autocommit off. 2) Have two prepared statements, calling executeQuery() on both 3) Gives two result sets. Can fetch data from both with next(). 4) If one statement gets an exception (say, caused by a division by zero) 5) not only this statement's result set is closed, but also the other open resultset. This happens with the client driver, whereas in embedded mode, the other result set is unaffected by the exception in the first result set (as it should be).


Field Summary
 
Fields inherited from class org.apache.derbyTesting.junit.BaseTestCase
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
 
Constructor Summary
ResultSetCloseTest(java.lang.String name)
          Create the test with the given name.
 
Method Summary
 void setUp()
          Create the tables and the Connection and PreparedStatements that will be used in this test.
static junit.framework.Test suite()
          Create test suite for this test.
 void testResultSetDoesNotClose()
          Test that the occurence of the exception in one of the PreparedStatements does not result in the closure of the ResultSet associated with the other Prepared Statements.
 
Methods inherited from class org.apache.derbyTesting.junit.BaseJDBCTestCase
assertCallError, assertCheckTable, assertCompileError, assertEquals, assertEquals, assertEquals, assertEquivalentDataType, assertGetIntError, assertNextError, assertPreparedStatementError, assertSQLExceptionEquals, assertSQLState, assertSQLState, assertStatementError, assertStatementError, assertStatementError, assertStatementError, assertTableRowCount, assertUpdateCount, assertUpdateCount, checkAllConsistency, checkEstimatedRowCount, commit, createStatement, createStatement, createStatement, dropTable, dropTable, getConnection, getDatabaseProperty, getLastSQLException, initializeConnection, openConnection, openDefaultConnection, openDefaultConnection, openUserConnection, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, rollback, runScript, runScript, runSQLCommands, setAutoCommit, tearDown, usingDB2Client, usingDerbyNetClient, usingEmbedded
 
Methods inherited from class org.apache.derbyTesting.junit.BaseTestCase
alarm, assertEquals, assertEquals, assertEquals, assertExecJavaCmdAsExpected, assertSecurityManager, assertThrowableEquals, execJavaCmd, fail, getFailureFolder, getJavaExecutableName, getSystemProperty, getTestConfiguration, getTestResource, openTestResource, println, printStackTrace, readProcessOutput, removeDirectory, removeDirectory, removeSystemProperty, runBare, setSystemProperty, traceit
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ResultSetCloseTest

public ResultSetCloseTest(java.lang.String name)
Create the test with the given name.

Parameters:
name - name of the test.
Method Detail

setUp

public void setUp()
           throws java.sql.SQLException
Create the tables and the Connection and PreparedStatements that will be used in this test.

Overrides:
setUp in class junit.framework.TestCase
Throws:
java.sql.SQLException

testResultSetDoesNotClose

public void testResultSetDoesNotClose()
                               throws java.sql.SQLException
Test that the occurence of the exception in one of the PreparedStatements does not result in the closure of the ResultSet associated with the other Prepared Statements. STEPS : 1) Execute the first PreparedStatement. This should not cause any SQLException. 2) Now execute the second PreparedStatement. This causes the expected Divide by zero exception. 3) Now access the first resultset again to ensure this is still open.

Throws:
java.sql.SQLException

suite

public static junit.framework.Test suite()
Create test suite for this test. Run in both embedded and client.


Built on Thu 2009-11-26 18:42:53-0800, from revision 884739

Apache Derby V10.6 Internals - Copyright © 2004,2008 The Apache Software Foundation. All Rights Reserved.