FileDocCategorySizeDatePackage
TestOCIPerfPrepInside.javaAPI DocExample1319Tue May 02 11:39:28 BST 2000None

TestOCIPerfPrepInside

public class TestOCIPerfPrepInside 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:oci7:@devdb02_ohsdb","zxvi01","donaldj8");
  PreparedStatement stmt = null;
  conn.setAutoCommit(false);
  startTime = System.currentTimeMillis();
  for (i=1;i<1001;i++) {
   stmt = conn.prepareStatement(
   "insert into oehr.testxxxperf ( id, code, descr, insert_user, insert_date ) " +
   "values ( ?, ?, ?, ?, ? )");
   stmt.setInt(1,i);
   stmt.setString(2,"123456789012345678901234567890");
   stmt.setString(3,"12345678901234567890123456789012345678901234567890123456789012345678901234567890");
   stmt.setString(4,"ZXVI01");
   stmt.setDate(5,new java.sql.Date(System.currentTimeMillis()));
   stmt.executeUpdate();
   stmt.close();
  }
  conn.commit(); 
  stopTime = System.currentTimeMillis();

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

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