FileDocCategorySizeDatePackage
RowPrefetch_connection.javaAPI DocExample2086Wed Sep 17 13:50:48 BST 1997None

RowPrefetch_connection

public class RowPrefetch_connection extends Object

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

    // Load the Oracle JDBC driver
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());

    // Connect to the database
    // You can put a database name after the @ sign in the connection URL.
    Connection conn =
      DriverManager.getConnection ("jdbc:oracle:oci7:@", "scott", "tiger");

    // set the RowPrefetch value from the Connection object
    // This sets the rowPrefetch for *all* statements belonging
    // to this connection.
    // The rowPrefetch value can be overriden for specific statements by
    // using the setRowPrefetch API on the statement object. Please look
    // at RowPrefetch_statement.java for an example.

    
    // Please note that any statements created *before* the connection
    // rowPrefetch was set, will use the default rowPrefetch.

    ((OracleConnection)conn).setDefaultRowPrefetch (30);
    
    Statement stmt = conn.createStatement ();
    
    // Check to verify statement rowPrefetch value is 30.
    int row_prefetch = ((OracleStatement)stmt).getRowPrefetch ();
    System.out.println ("The RowPrefetch for the statement is:  "
			+ row_prefetch + "\n");

    ResultSet rset = stmt.executeQuery ("select ename from emp");
    
    while(rset.next ())
    {
      System.out.println (rset.getString (1));
    }
    stmt.close ();