If I understand correctly, runstats does wrap the code of interest in
the provided Java above.
My version below is also modified to persist multi-session information, in
addition to the facets I listed above.
It uses a modified runstats that accepts a session id and a test name.
The Java provides separate test cases declaring Prepared statements in CLASS vs
method, and it attempts to invoke their SQL once before starting Runstats.
Possibly I will see those effects as I better understood the output.
I have yet to fathom documentation which says declaring a Prepared Statement
(not initializing it) at the Java CLASS level would avoid an Oracle "Soft Parse".
But I'm in this to learn.
Tom Starr
I hope this is useful to others.
I will paste the modified runstats and bulk_collect packages into a separate post
to stay under the size limit:
/*
* Purpose: Compare Oracle & non-Oracle JDBC Batching to PLSQL array passing with
* FORALL to BULK COLLECT / FORALL
*
* Author: twstarr - Based on original work noted below
* (Not optimized - Not a real Java programmer)
*
* Based on the following:
*
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1210436024540#18176936452010 * Subject: "Bulk operations. jdbc using batch option VS jdbc calling stored proced..."
* Original Java TestBatchUpdates program kindly provided by Menon
* Modified Java TestBatchUpdates based on Menon's program kindly provided by Edgar Chupit
*
* Depends on the following to display output from PL/SQL:
* Tom Kyte's DbmsOutput.java must exist in the CLASSPATH (same dirctory in this case):
*
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:45027262935845 *
* Depends on the following to compare performance between successive tests:
* Tom Kyte's PL/SQL PACKAGE RUNSTATS Package must be available in the current schema:
*
http://asktom.oracle.com/tkyte/runstats *
* Depends on the DDL and PL/SQL in the subsequent post below.
*
* To compile in UNIX (for DOS replace $ORACLE_HOME with %ORACLE_HOME% and / with \ and : with ;):
* $ORACLE_HOME/jdk/bin/javac CompareBatchBulkUpdating.java -classpath .:$ORACLE_HOME/jdbc/lib/classes12.zip
*
* To run in UNIX (for DOS replace $ORACLE_HOME with %ORACLE_HOME% and / with \ and : with ;):
* $ORACLE_HOME/jdk/bin/java -classpath .:$ORACLE_HOME/jdbc/lib/classes12.zip CompareBatchBulkUpdating 100000 1 10 1000 2
*
* Usage:
* First value is mode:
* Second value is number of records to insert
* Third and Forth values are Batch or LIMIT values
* Forth value is session identifier
* Allowable modes are 1-9 as follows:
* Mode 1 is Oracle JDBC Batching (per Menon)
* Mode 2 is Oracle JDBC Batching (per Menon but declaring the PreparedStatement in the CLASS)
* Mode 3 is non-Oracle JDBC batching
* Mode 4 is non-Oracle JDBC batching (declaring the PreparedStatement in the CLASS not in MAIN)
* Mode 5 is sending batch size array chunks to PL/SQL using FORALL (per Edgar)(very slow)
* Mode 6 is calling PL/SQL which uses FORALL and BULK COLLECT from a TABLE with a passed in LIMIT twice
* Mode 7 is calling PL/SQL which uses FORALL and BULK COLLECT from an MVIEW with a passed in LIMIT twice
* Mode 8 is calling PL/SQL which uses FORALL and BULK COLLECT once from a TABLE with two LIMITs
* Mode 9 is calling PL/SQL which uses FORALL and BULK COLLECT once from an MVIEW with two LIMITs
*
*/
import java.sql.*;
import oracle.sql.DATE;
import oracle.sql.ARRAY;
import oracle.sql.NUMBER;
import oracle.sql.ArrayDescriptor;
import oracle.jdbc.driver.*;
public class CompareBatchBulkUpdating
{
public static void main(String[] args) throws SQLException
{
System.out.println( "In main method of CompareBatchBulkUpdating after preload updates");
DriverManager.registerDriver( new OracleDriver());
_checkUsage( args );
_setBatchValues ( args );
OracleConnection connection = _getOracleConnection();
((OracleConnection) connection).setDefaultRowPrefetch(100);
_dbmsOutput = new DbmsOutput ( connection );
_dbmsOutput.enable ( DBMS_OUTPUT_BUFFER_SIZE );
long updateCount = 0;
// execute the requested mode
switch(OPMODE)
{
case(1):
System.out.print("Case 1: Original Oracle JDBC Update Batching per Menon with OraclePreparedStatement declared in instance (main()) \nComparing batch sizes: ");
System.out.print( UPDATE_BATCH_SIZES_BEING_TESTED[0]);
System.out.print(" and ");
System.out.println( UPDATE_BATCH_SIZES_BEING_TESTED[1]);
System.out.print(" for record count: ");
System.out.println( NUMBER_OF_RECORDS_INSERTED );
_prepareBenchmarkStatements ( connection,
"Case 1: Original Oracle JDBC Update Batching per Menon with OraclePreparedStatement declared in instance (main())");
statementString = "insert into bctab1 values ( ?,?,?,? )";
OraclePreparedStatement opslocal1 = (OraclePreparedStatement) connection.prepareStatement ( statementString );
strDate = "2008-03-31 06:00:00";
someOracleDATE = new oracle.sql.DATE( strDate );
//Get this SQL into the shared pool
opslocal1.setInt(1, 1 );
opslocal1.setDATE(2,someOracleDATE );
opslocal1.setInt(3, 1 );
opslocal1.setInt(4, 1 );
updateCount += opslocal1.executeUpdate();
updateCount += opslocal1.sendBatch();
_benchmarkStatementArray[BENCHMARK_START_INDEX].execute();
// for each batch size being tested
for( int k = 0; k < UPDATE_BATCH_SIZES_BEING_TESTED.length; k++)
{
opslocal1.setExecuteBatch ( UPDATE_BATCH_SIZES_BEING_TESTED[k] );
// benchmark starts
long startTime = System.currentTimeMillis();
updateCount = 0;
for( int i=0; i < NUMBER_OF_RECORDS_INSERTED; i++)
{
opslocal1.setInt(1, i );
opslocal1.setDATE(2,someOracleDATE );
opslocal1.setInt(3, i );
opslocal1.setInt(4, i*i*3 );
updateCount += opslocal1.executeUpdate();
}
updateCount += opslocal1.sendBatch(); // remaining data if any not really necessary since commit does
connection.commit();
long endTime = System.currentTimeMillis();
if( k == 0 ) // set the middle point only in first iteration
_benchmarkStatementArray[BENCHMARK_MIDDLE_INDEX].execute();
// benchmark ends
long timeTaken = (endTime - startTime);
benchmarkTimingResults[k] = timeTaken;
}
_benchmarkStatementArray[BENCHMARK_STOP_INDEX].execute();
opslocal1.close();
break;
case(2):
System.out.print("Case 2: Original Oracle JDBC Update Batching per Menon but with OraclePreparedStatement declared in CLASS \nComparing batch sizes: ");
System.out.print( UPDATE_BATCH_SIZES_BEING_TESTED[0]);
System.out.print(" and ");
System.out.println( UPDATE_BATCH_SIZES_BEING_TESTED[1]);
System.out.print(" for record count: ");
System.out.println( NUMBER_OF_RECORDS_INSERTED );
_prepareBenchmarkStatements ( connection,
"Case 2: Original Oracle JDBC Update Batching per Menon but with OraclePreparedStatement declared in CLASS");
statementString = "insert into bctab1 values ( ?,?,?,? )";
statementString = "insert into bctab2 values ( ?,?,?,? )";
ops = (OraclePreparedStatement) connection.prepareStatement ( statementString );
strDate = "2008-03-31 06:00:00";
someOracleDATE = new oracle.sql.DATE( strDate );
//Get this SQL into the shared pool
ops.setInt(1, 1 );
ops.setDATE(2,someOracleDATE );
ops.setInt(3, 1 );
ops.setInt(4, 1 );
updateCount += ops.executeUpdate();
updateCount += ops.sendBatch();
_benchmarkStatementArray[BENCHMARK_START_INDEX].execute();
// for each batch size being tested
for( int k = 0; k < UPDATE_BATCH_SIZES_BEING_TESTED.length; k++)
{
ops.setExecuteBatch ( UPDATE_BATCH_SIZES_BEING_TESTED[k] );
// benchmark starts
long startTime = System.currentTimeMillis();
updateCount = 0;
for( int i=0; i < NUMBER_OF_RECORDS_INSERTED; i++)
{
ops.setInt(1, i );
ops.setDATE(2,someOracleDATE );
ops.setInt(3, i );
ops.setInt(4, i*i*3 );
updateCount += ops.executeUpdate();
}
updateCount += ops.sendBatch(); // remaining data if any not really necessary since commit does
connection.commit();
long endTime = System.currentTimeMillis();
if( k == 0 ) // set the middle point only in first iteration
_benchmarkStatementArray[BENCHMARK_MIDDLE_INDEX].execute();
// benchmark ends
long timeTaken = (endTime - startTime);
benchmarkTimingResults[k] = timeTaken;
}
_benchmarkStatementArray[BENCHMARK_STOP_INDEX].execute();
ops.close();
break;
case(3):
System.out.print("Case 3: Non-Oracle manual JDBC Update Batching \nComparing batch sizes: ");
System.out.print( UPDATE_BATCH_SIZES_BEING_TESTED[0]);
System.out.print(" and ");
System.out.println( UPDATE_BATCH_SIZES_BEING_TESTED[1]);
System.out.print(" for record count: ");
System.out.println( NUMBER_OF_RECORDS_INSERTED );
_prepareBenchmarkStatements ( connection,
"Case 3: Non-Oracle manner JDBC Update Batching");
statementString = "insert into bctab1 values ( ?,?,?,? )";
statementString = "insert into bctab3 values ( ?,?,?,? )";
ps = (PreparedStatement) connection.prepareStatement ( statementString );
someJavaDate = java.sql.Date.valueOf( "2008-03-31" );
//Get this SQL into the shared pool
ps.setInt(1, 1);
ps.setDate(2, someJavaDate);
ps.setInt(3, 1);
ps.setInt(4, 1);
updateCount += ps.executeUpdate();
_benchmarkStatementArray[BENCHMARK_START_INDEX].execute();
// for each batch size being tested
for( int k = 0; k < UPDATE_BATCH_SIZES_BEING_TESTED.length; k++)
{
// benchmark starts
long startTime = System.currentTimeMillis();
updateCount = 0;
for( int i=0; i < NUMBER_OF_RECORDS_INSERTED; i++)
{
ps.setInt(1, i );
ps.setDate(2, someJavaDate);
ps.setInt(3, i );
ps.setInt(4, i*i*3 );
updateCount += ps.executeUpdate();
if( i > 0 && i%UPDATE_BATCH_SIZES_BEING_TESTED[k] == 0 )
{
updateCount += ps.executeBatch().length;
}
}
updateCount += ps.executeBatch().length; // remaining data if any
connection.commit();
long endTime = System.currentTimeMillis();
if( k == 0 ) // set the middle point only in first iteration
_benchmarkStatementArray[BENCHMARK_MIDDLE_INDEX].execute();
// benchmark ends
long timeTaken = (endTime - startTime);
benchmarkTimingResults[k] = timeTaken;
}
_benchmarkStatementArray[BENCHMARK_STOP_INDEX].execute();
ps.close();
break;
case(4):
System.out.print("Case 4: Non-Oracle manual JDBC Update Batching with PreparedStatement declared in CLASS \nComparing batch sizes: ");
System.out.print( UPDATE_BATCH_SIZES_BEING_TESTED[0]);
System.out.print(" and ");
System.out.println( UPDATE_BATCH_SIZES_BEING_TESTED[1]);
System.out.print(" for record count: ");
System.out.println( NUMBER_OF_RECORDS_INSERTED );
_prepareBenchmarkStatements ( connection,
"Case 4: Non-Oracle manual JDBC Update Batching with PreparedStatement declared in CLASS");
statementString = "insert into bctab4 values ( ?,?,?,? )";
PreparedStatement pslocal = (PreparedStatement) connection.prepareStatement ( statementString );
java.sql.Date someJavaDate = java.sql.Date.valueOf( "2008-03-31" );
//Get this SQL into the shared pool
pslocal.setInt(1, 1);
pslocal.setDate(2, someJavaDate);
pslocal.setInt(3, 1);
pslocal.setInt(4, 1);
updateCount += pslocal.executeUpdate();
_benchmarkStatementArray[BENCHMARK_START_INDEX].execute();
// for each batch size being tested
for( int k = 0; k < UPDATE_BATCH_SIZES_BEING_TESTED.length; k++)
{
// benchmark starts
long startTime = System.currentTimeMillis();
updateCount = 0;
for( int i=0; i < NUMBER_OF_RECORDS_INSERTED; i++)
{
pslocal.setInt(1, i );
pslocal.setDate(2, someJavaDate);
pslocal.setInt(3, i );
pslocal.setInt(4, i*i*3 );
updateCount += pslocal.executeUpdate();
if( i > 0 && i%UPDATE_BATCH_SIZES_BEING_TESTED[k] == 0 )
{
updateCount += pslocal.executeBatch().length;
}
}
updateCount += pslocal.executeBatch().length; // remaining data if any
connection.commit();
long endTime = System.currentTimeMillis();
if( k == 0 ) // set the middle point only in first iteration
_benchmarkStatementArray[BENCHMARK_MIDDLE_INDEX].execute();
// benchmark ends
long timeTaken = (endTime - startTime);
benchmarkTimingResults[k] = timeTaken;
}
_benchmarkStatementArray[BENCHMARK_STOP_INDEX].execute();
pslocal.close();
break;
case(5):
System.out.print("Case 5: Calling PL/SQL using FORALL passing batch size ARRAY chunks (per Edgar) \nComparing sizes: ");
System.out.print( UPDATE_BATCH_SIZES_BEING_TESTED[0]);
System.out.print(" and ");
System.out.println( UPDATE_BATCH_SIZES_BEING_TESTED[1]);
System.out.print(" for record count: ");
System.out.println( NUMBER_OF_RECORDS_INSERTED );
_prepareBenchmarkStatements ( connection,
"Case 5: Calling PL/SQL using FORALL passing batch size ARRAY chunks (per Edgar)");
//Addition: Attempt to preload this SQL into the shared pool
statementString = "INSERT INTO bctab5 (id,code,val) VALUES (?,?,?)";
ops = (OraclePreparedStatement) connection.prepareStatement ( statementString );
ops.setInt(1, 1);
ops.setInt(2, 1);
ops.setInt(3, 1);
updateCount += ops.executeUpdate();
updateCount += ops.sendBatch();
statementString = "begin bulkcollpkg.doInsert(?,?); end;";
ocs = (OracleCallableStatement) connection.prepareCall ( statementString );
desc = ArrayDescriptor.createDescriptor( "TOMS.INTEGERARRAY", connection );
_benchmarkStatementArray[BENCHMARK_START_INDEX].execute();
// for each batch size being tested
for( int k = 0; k < UPDATE_BATCH_SIZES_BEING_TESTED.length; k++)
{
// benchmark starts
long startTime = System.currentTimeMillis();
updateCount = 0;
int[] aCode = new int [ UPDATE_BATCH_SIZES_BEING_TESTED[k] ];
int[] aVal = new int [ UPDATE_BATCH_SIZES_BEING_TESTED[k] ];
for( int i=0; i < NUMBER_OF_RECORDS_INSERTED; i++)
{
if( i%UPDATE_BATCH_SIZES_BEING_TESTED[k] == 0 && i > 0 )
{
ocs.setArray(1,new ARRAY (desc, connection, aCode) );
ocs.setArray(2,new ARRAY (desc, connection, aVal) );
ocs.execute();
// if NUMBER_OF_RECORDS_INSERTED%UPDATE_BATCH_SIZES_BEING_TESTED[k] != 0 than
// last portion of data will be smaller than UPDATE_BATCH_SIZES_BEING_TESTED[k]
if( (NUMBER_OF_RECORDS_INSERTED-i > 0) && (UPDATE_BATCH_SIZES_BEING_TESTED[k] >
NUMBER_OF_RECORDS_INSERTED-i) )
{
aCode = new int [ NUMBER_OF_RECORDS_INSERTED-i ];
aVal = new int [ NUMBER_OF_RECORDS_INSERTED-i ];
}
}
aCode[(i%UPDATE_BATCH_SIZES_BEING_TESTED[k])] = i;
aVal[(i%UPDATE_BATCH_SIZES_BEING_TESTED[k])] = i*i*3;
}
//Is oracle.jdbc.OracleCallableStatement.setArray(int,oracle.sql.Array)
//Is inherited from oracle.jdbc.OraclePreparedStatement
//Is inherited from java.sql.OraclePreparedStatement
//Is INTERFACE java.sql.Array NOT CLASS oracle.sql.ARRAY
//Driver converts java.sql.Array to a SQL ARRAY value when sending to database
//INTERFACE oracle.jdbc.OracleCallableStatement extends INTERFACE oracle.jdbc.OraclePreparedStatement
//INTERFACE oracle.jdbc.OracleCallableStatement extends INTERFACE java.sql.OracleCallableStatement
ocs.setArray(1,new ARRAY (desc, connection, aCode) );
ocs.setArray(2,new ARRAY (desc, connection, aVal) );
ocs.execute();
connection.commit();
long endTime = System.currentTimeMillis();
if( k == 0 ) // set the middle point only in first iteration
_benchmarkStatementArray[BENCHMARK_MIDDLE_INDEX].execute();
// benchmark ends
long timeTaken = (endTime - startTime);
benchmarkTimingResults[k] = timeTaken;
}
_benchmarkStatementArray[BENCHMARK_STOP_INDEX].execute();
ocs.close();
break;
case(6):
System.out.print("Case 6: Calling PL/SQL which uses FORALL and BULK COLLECT with a passed in batch size LIMIT \nComparing batch sizes: ");
System.out.print( UPDATE_BATCH_SIZES_BEING_TESTED[0]);
System.out.print(" and ");
System.out.println( UPDATE_BATCH_SIZES_BEING_TESTED[1]);
System.out.print(" for record count: ");
System.out.println( NUMBER_OF_RECORDS_INSERTED );
_prepareBenchmarkStatements ( connection,
"Case 6: Calling PL/SQL which uses FORALL and BULK COLLECT with a passed in batch size LIMIT");
statementString = "begin bulkcollpkg.doBulkInsert1(?); end;";
ocs = (OracleCallableStatement) connection.prepareCall ( statementString );
_benchmarkStatementArray[BENCHMARK_START_INDEX].execute();
// for each batch size being tested
for( int k = 0; k < UPDATE_BATCH_SIZES_BEING_TESTED.length; k++)
{
// benchmark starts
long startTime = System.currentTimeMillis();
int aBat = UPDATE_BATCH_SIZES_BEING_TESTED[k];
//CLASS oracle.sql.NUMBER
//No setNumber() in java.sql or oracle.jdbc.sql
ocs.setNUMBER(1,new NUMBER(aBat));
ocs.execute();
connection.commit();
long endTime = System.currentTimeMillis();
if( k == 0 ) // set the middle point only in first iteration
_benchmarkStatementArray[BENCHMARK_MIDDLE_INDEX].execute();
// benchmark ends
long timeTaken = (endTime - startTime);
benchmarkTimingResults[k] = timeTaken;
}
_benchmarkStatementArray[BENCHMARK_STOP_INDEX].execute();
ocs.close();
break;
case(7):
System.out.print("Case 7: Calling PL/SQL which uses FORALL and BULK COLLECT from MVIEW with a passed in batch size LIMIT \nComparing batch sizes: ");
System.out.print( UPDATE_BATCH_SIZES_BEING_TESTED[0]);
System.out.print(" and ");
System.out.println( UPDATE_BATCH_SIZES_BEING_TESTED[1]);
System.out.print(" for record count: ");
System.out.println( NUMBER_OF_RECORDS_INSERTED );
_prepareBenchmarkStatements ( connection,
"Case 7: Calling PL/SQL which uses FORALL and BULK COLLECT from MVIEW with a passed in batch size LIMIT");
statementString = "begin bulkcollpkg.doBulkInsert2(?); end;";
ocs = (OracleCallableStatement) connection.prepareCall ( statementString );
_benchmarkStatementArray[BENCHMARK_START_INDEX].execute();
// for each batch size being tested
for( int k = 0; k < UPDATE_BATCH_SIZES_BEING_TESTED.length; k++)
{
// benchmark starts
long startTime = System.currentTimeMillis();
int aBat = UPDATE_BATCH_SIZES_BEING_TESTED[k];
//CLASS oracle.sql.NUMBER
//No setNumber() in java.sql or oracle.jdbc.sql
ocs.setNUMBER(1,new NUMBER(aBat));
ocs.execute();
connection.commit();
long endTime = System.currentTimeMillis();
if( k == 0 ) // set the middle point only in first iteration
_benchmarkStatementArray[BENCHMARK_MIDDLE_INDEX].execute();
// benchmark ends
long timeTaken = (endTime - startTime);
benchmarkTimingResults[k] = timeTaken;
}
_benchmarkStatementArray[BENCHMARK_STOP_INDEX].execute();
ocs.close();
break;
case(8):
System.out.print("Case 8: Calling PL/SQL which uses FORALL and BULK COLLECT once with two passed in LIMIT \nComparing sizes: ");
System.out.print( UPDATE_BATCH_SIZES_BEING_TESTED[0]);
System.out.print(" and ");
System.out.println( UPDATE_BATCH_SIZES_BEING_TESTED[1]);
System.out.print(" for record count: ");
System.out.println( NUMBER_OF_RECORDS_INSERTED );
System.out.println("Note: In this case RUNSTATS is run within the PLSQL rather than invoked via JDBC.");
System.out.println(" For some reason the millisecond values obtained from DBMS_UTILITY.GET_TIME are too long.");
_prepareBenchmarkStatements ( connection,
"Case 8: Calling PL/SQL which uses FORALL and BULK COLLECT once with two passed in LIMIT");
statementString = "{? = call bulkcollpkg.doBulkInsert3(?,?) }";
ocs = (OracleCallableStatement) connection.prepareCall ( statementString );
ocs.registerOutParameter(1,OracleTypes.ARRAY,"TOMS.INTEGERTIMINGARRAY");
ocs.setNUMBER(2,new NUMBER(UPDATE_BATCH_SIZES_BEING_TESTED[0]));
ocs.setNUMBER(3,new NUMBER(UPDATE_BATCH_SIZES_BEING_TESTED[1]));
ocs.execute();
results = ocs.getARRAY(1);
resultset = results.getResultSet();
if (resultset.next())
benchmarkTimingResults[0] = resultset.getInt(2);
if (resultset.next())
benchmarkTimingResults[1] = resultset.getInt(2);
// benchmark run within PLSQL
ocs.close();
break;
case(9):
System.out.print("Case 9: Calling PL/SQL which uses FORALL and BULK COLLECT from MVIEW once with two passed in LIMIT \nComparing sizes: ");
System.out.print( UPDATE_BATCH_SIZES_BEING_TESTED[0]);
System.out.print(" and ");
System.out.println( UPDATE_BATCH_SIZES_BEING_TESTED[1]);
System.out.print(" for record count: ");
System.out.println( NUMBER_OF_RECORDS_INSERTED );
System.out.println("Note: In this case RUNSTATS is run within the PLSQL rather than invoked via JDBC.");
System.out.println(" For some reason the millisecond values obtained from DBMS_UTILITY.GET_TIME are too long.");
_prepareBenchmarkStatements ( connection,
"Case 9: Calling PL/SQL which uses FORALL and BULK COLLECT from MVIEW once with two passed in LIMIT");
statementString = "{? = call bulkcollpkg.doBulkInsert4(?,?) }";
ocs = (OracleCallableStatement) connection.prepareCall ( statementString );
ocs.registerOutParameter(1,OracleTypes.ARRAY,"TOMS.INTEGERTIMINGARRAY");
ocs.setNUMBER(2,new NUMBER(UPDATE_BATCH_SIZES_BEING_TESTED[0]));
ocs.setNUMBER(3,new NUMBER(UPDATE_BATCH_SIZES_BEING_TESTED[1]));
ocs.execute();
results = ocs.getARRAY(1);
resultset = results.getResultSet();
if (resultset.next())
benchmarkTimingResults[0] = resultset.getInt(2);
if (resultset.next())
benchmarkTimingResults[1] = resultset.getInt(2);
// benchmark run within PLSQL
ocs.close();
break;
}
_printBenchmarkResults ();
System.out.println( "----Java Timer based results begin\n" );
for (int i=0; i < UPDATE_BATCH_SIZES_BEING_TESTED.length; i++)
{
System.out.println( "Milliseconds taken for inserting " + NUMBER_OF_RECORDS_INSERTED +
" with a batch size of " + UPDATE_BATCH_SIZES_BEING_TESTED[i] +
" = " + benchmarkTimingResults[i] );
System.out.flush();
}
System.out.println( "----Java Timer based results end\n" );
_closeBenchmarkStatements ( connection );
connection.close();
}
private static void _closeBenchmarkStatements ( OracleConnection connection ) throws SQLException
{
for( int i=0; i < _benchmarkStatementArray.length; i++)
{
_benchmarkStatementArray[i].close();
}
}
private static void _prepareBenchmarkStatements ( OracleConnection connection, String thisTest ) throws SQLException
{
_benchmarkStatementArray[BENCHMARK_START_INDEX]= (OracleCallableStatement) connection.prepareCall( BENCHMARK_START );
_benchmarkStatementArray[BENCHMARK_START_INDEX].setInt(1, sessionId);
_benchmarkStatementArray[BENCHMARK_START_INDEX].setString(2, thisTest);
_benchmarkStatementArray[BENCHMARK_MIDDLE_INDEX]= (OracleCallableStatement) connection.prepareCall( BENCHMARK_MIDDLE );
_benchmarkStatementArray[BENCHMARK_MIDDLE_INDEX].setInt(1, sessionId);
_benchmarkStatementArray[BENCHMARK_MIDDLE_INDEX].setString(2, thisTest);
_benchmarkStatementArray[BENCHMARK_STOP_INDEX]= (OracleCallableStatement) connection.prepareCall( BENCHMARK_STOP );
_benchmarkStatementArray[BENCHMARK_STOP_INDEX].setInt(1, sessionId);
_benchmarkStatementArray[BENCHMARK_STOP_INDEX].setString(2, thisTest);
_benchmarkStatementArray[BENCHMARK_STOP_INDEX].setInt(3, BENCHMARK_DIFFERENCE_THRESHOLD);
}
private static void _checkUsage (String[] ar