Databases Reference
In-Depth Information
ps.registerOutParameter(1, OracleTypes.CURSOR);
ps.execute();
ResultSet result = ((OracleCallableStatement)
ps).getCursor(1);
while (result.next()) {
String row = result.getInt("PROD_ID") + " "
+ result.getDouble("AMOUNT");
System.out.println(row);
}
ps.close();
} catch (Exception e) {
System.out.println(String.format("Error %s",
e.getLocalizedMessage()));
System.exit(1);
}
}
public static void flush(Connection conn) throws SQLException {
try {
Statement s = conn.createStatement();
s.execute("ALTER SYSTEM FLUSH SHARED_POOL");
s.execute("ALTER SYSTEM FLUSH BUFFER_CACHE");
s.close();
System.out.println("System altered");
} catch (Exception e) {
System.out.println(String.format("Error %s",
e.getLocalizedMessage()));
System.exit(1);
}
}
public static void main(String[] args) throws SQLException {
Connection conn = null;
try {
Class.forName(driver);
String pass = JOptionPane.showInputDialog(
"Insert SYS password:");
conn = DriverManager.getConnection(connectionString, user,
pass);
long startTime = System.currentTimeMillis();
flush(conn);
useQuery(conn);
long stopTimeSingle = System.currentTimeMillis();
flush(conn);
 
Search WWH ::




Custom Search