long startTime;
long stopTime;
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn =
DriverManager.getConnection("jdbc:oracle:thin:@dssw2k01:1521:orcl","scott","tiger");
conn.setAutoCommit(false);
Statement stmt = conn.createStatement();
stmt.executeUpdate(
"insert into testxxxperf ( id, code, descr, insert_user, insert_date ) "+
"values ( 1, '123456789012345678901234567890', " +
"'12345678901234567890123456789012345678901234567890123456789012345678901234567890', " +
"USER, SYSDATE )");
conn.commit();
startTime = System.currentTimeMillis();
((OracleStatement)stmt).defineColumnType(1, Types.NUMERIC);
((OracleStatement)stmt).defineColumnType(2, Types.VARCHAR);
((OracleStatement)stmt).defineColumnType(3, Types.VARCHAR);
((OracleStatement)stmt).defineColumnType(4, Types.VARCHAR);
((OracleStatement)stmt).defineColumnType(5, Types.TIMESTAMP);
ResultSet rset = stmt.executeQuery(
"select id, code, descr, insert_user, insert_date" +
" from testxxxperf where id = 1");
rset.next();
stopTime = System.currentTimeMillis();
rset.close();
stmt.executeUpdate("delete testxxxperf where id = 1");
conn.commit();
stmt.close();
conn.close();
System.out.println( "Elapsed time in milliseconds: " + Long.toString( stopTime - startTime ) );