Sydney Oracle Meetup Message Board › Ric Van Dyke of Hotsos presentation | ARRAY SIZE in JAVA

Ric Van Dyke of Hotsos presentation | ARRAY SIZE in JAVA

Yury Velikanov
Posted Apr 17, 2009 7:03 PM
user 9156087
Sydney, AU
Post #: 3
Send an Email Post a Greeting
If somebody is interested in playing with ARRAY size parameter in Java then the following statement sets it:
((OracleConnection)conn).setDefaultRowPrefetch (Integer.parseInt(args[6]));

The full test code is bellow. I played with that parameter myself and in extreme cases yous might end=up with 10-100 times difference.

Yury (Jurijs)


FULL CODE:

import oracle.jdbc.driver.*;
import java.sql.*;

class J {
public static void main (String args []) throws SQLException {
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:@"+ args[0], args[1], args[2]);

//Set the default row prefetch setting for this connection def=10

//-----======<<<<< !!!!!
((OracleConnection)conn).setDefaultRowPrefetch (Integer.parseInt(args[6]));
//-----======<<<<< !!!!!


System.out.println ("BEGIN");

Statement stmt = conn.createStatement ();
ResultSet rset = stmt.executeQuery (args[3]);
String vcounter = "0";

while (rset.next ()) {
vcounter=rset.getString (1);
try {java.lang.Thread.sleep(Integer.parseInt(args[4]));} catch (InterruptedException e) {}
}

rset.close();
System.out.println ("END");
}
}


the way to execute it is:
java J "host:1521:SID" user password "select * from testf where rownum < 100001" 0 0 <array size>
Alex Gorbachev
Posted Apr 18, 2009 7:15 PM
alexgorbachev
Ottawa, ON
Post #: 9
Send an Email Post a Greeting
Java programmers never use JDBC interface. :) It's all abstracted behind some kind of obj-rel mapping. :)

but seriously, thanks for info - good to know.
Powered by mvnForum

Our Sponsors

The Pythian Group

Database services & consulting in Australia. Meetup organizer.

Other nearby
Meetups
Why these groups?
x

The Meetup Groups shown here are topically similar to Sydney Oracle Meetup.

Groups are more likely to be displayed here if they:

  • have a Meetup scheduled
  • have a high rating
  • have a group photo
  • are "public" and not "private"
  • have shown they are likely to stick around (older than 30 days)

Log in

  • Not registered with us yet?
or

Log in to Meetup with your Facebook account.

Sign up

or

Join this Meetup Group even quicker with your Facebook account.

By clicking the "Sign up using Facebook" or "Sign up" buttons above, you agree to Meetup's Terms of Service