public void _testStatements() throws Exception {
  Connection connection=getConnectionViaDriverManager();
  connection.setAutoCommit(false);
  try {
    Statement stmt=connection.createStatement();
    ResultSet rs=stmt.executeQuery("SELECT * FROM rdb$database");
    rs.close();
    RandomSelector selector1=new RandomSelector(stmt,SELECT_TABLE_1,RECORD_COUNT);
    RandomSelector selector2=new RandomSelector(stmt,SELECT_TABLE_2,RECORD_COUNT);
    Thread thread1=new Thread(selector1,"Selector 1");
    Thread thread2=new Thread(selector2,"Selector 2");
    thread1.start();
    thread2.start();
    Thread.sleep(TEST_TIME_SECONDS * 1000);
    selector1.stop();
    selector2.stop();
    thread1.join();
    thread2.join();
    stmt.close();
  }
  finally {
    connection.close();
  }
}

public void _testStatements ( ) throws Exception { Connection connection = getConnectionViaDriverManager ( ) ; connection . setAutoCommit ( false ) ; try { Statement stmt = connection . createStatement ( ) ; ResultSet rs = stmt . executeQuery ( "SELECT * FROM rdb$database" ) ; rs . close ( ) ; RandomSelector selector1 = new RandomSelector ( stmt , SELECT_TABLE_1 , RECORD_COUNT ) ; RandomSelector selector2 = new RandomSelector ( stmt , SELECT_TABLE_2 , RECORD_COUNT ) ; Thread thread1 = new Thread ( selector1 , "Selector 1" ) ; Thread thread2 = new Thread ( selector2 , "Selector 2" ) ; thread1 . start ( ) ; thread2 . start ( ) ; Thread . sleep ( TEST_TIME_SECONDS * 1000 ) ; selector1 . stop ( ) ; selector2 . stop ( ) ; thread1 . join ( ) ; thread2 . join ( ) ; stmt . close ( ) ; } finally { connection . close ( ) ; } }
test if single statement can be safely used in multiple transactions . the only visible outcome of this test case are messages in stderr that result set was closed . any other error message means test case failure .
