Assuming a Connection conn, you can set the FetchSize like this:
// Remember the current autocommit state boolean autoCommit = conn.getAutoCommit(); // Make sure autocommit is off conn.setAutoCommit(false); Statement st = conn.createStatement(); // Turn use of the cursor on by setting FetchSize, expressed in rows st.setFetchSize(50); ResultSet rs = st.executeQuery("SELECT * FROM mytable"); // Set the autocommit state back conn.setAutoCommit(autoCommit); while (rs.next()) { System.out.print("a row was returned."); } rs.close(); // Close the statement. st.close();