Use the Statement.setCursorName or SybStatement.setFetchSize method to create a cursor .
// With conn as a Connection object, create a // Statement object and assign it a cursor using // Statement.setCursorName(). Statement stmt = conn.createStatement(); stmt.setCursorName("author_cursor"); // Use the statement to execute a query and return // a cursor result set. ResultSet rs = stmt.executeQuery("SELECT au_id,
au_lname, au_fname FROM authors WHERE city = 'Oakland'"); while(rs.next()) { ... } // Create a second statement object and use // SybStatement.setFetchSize()to create a cursor // that returns 10 rows at a time. SybStatement syb_stmt = conn.createStatement(); syb_stmt.setFetchSize(10); // Use the syb_stmt to execute a query and return // a cursor result set. SybCursorResultSet rs2 = (SybCursorResultSet)syb_stmt.executeQuery ("SELECT au_id, au_lname, au_fname FROM authors WHERE city = 'Pinole'"); while(rs2.next()) { ... } // Get the name of the cursor created through the // setFetchSize() method. String cursor_name = rs2.getCursorName(); ...
// For jConnect 6.0, create a third statement // object using the new method on Connection, // and obtain a SCROLL_INSENSITIVE ResultSet. // Note: you no longer have to downcast the // Statement or the ResultSet.
Statement stmt = conn.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
ResultSet rs3 = stmt.executeQuery ("SELECT ... [whatever]");
// Execute any of the JDBC 2.0 methods that // are valid for read only ResultSets.
rs3.next(); rs3.previous(); rs3.relative(3); rs3.afterLast();
...