FileDocCategorySizeDatePackage
TestOCIPerfAutoCommit.javaAPI DocExample1227Fri Apr 06 14:57:14 BST 2001None

TestOCIPerfAutoCommit

public class TestOCIPerfAutoCommit extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

  int i;
  long startTime; 
  long stopTime;
  DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
  Connection conn = 
   DriverManager.getConnection("jdbc:oracle:oci8:@dssw2k01","scott","tiger");
  Statement stmt = conn.createStatement();
  SimpleDateFormat sdf = new SimpleDateFormat( "yyyyMMddHHmmss" );
  startTime = System.currentTimeMillis();
  for (i=1;i<1001;i++) {
   stmt.executeUpdate("insert into testxxxperf ( id, code, descr, insert_user, insert_date ) " +
    "values ( " + Integer.toString( i ) + ", '123456789012345678901234567890', " + 
    "'12345678901234567890123456789012345678901234567890123456789012345678901234567890', " +
    "USER, to_date('" + sdf.format(new java.util.Date(System.currentTimeMillis())) + "', 'YYYYMMDDHH24MISS'))");
  }
  stopTime = System.currentTimeMillis();

  Statement dstmt = conn.createStatement();
  dstmt.executeUpdate("delete testxxxperf");
  dstmt.close();

  stmt.close();
  conn.close();
  System.out.println( "Elapsed time in milliseconds: " + Long.toString( stopTime - startTime ) );