Scrollable Insensitive Result Sets

JDBC provides two types of result sets that allow you to scroll in either direction or to move the cursor to a particular row. GemFire XD supports one of these types: scrollable insensitive result sets (ResultSet.TYPE_SCROLL_INSENSITIVE).

When you use a result set of type of type ResultSet.TYPE_SCROLL_INSENSITIVE, GemFire XD materializes rows from the first one in the result set up to the one with the biggest row number as the rows are requested. The materialized rows are backed to disk if necessary, to avoid excessive memory usage.

Insensitive result sets, in contrast to sensitive result sets, cannot see changes made by others on the rows that have materialized. GemFire XD allows updates of scrollable insensitive result sets, as described in Visibility of changes. (GemFire XD also allows updates of forward-only result sets.)

Note: GemFire XD does not support result sets of type ResultSet.TYPE_SCROLL_SENSITIVE.
//autocommit does not have to be off because even if 
//we accidentally scroll past the last row, the implicit commit
//on the the statement will not close the result set because result sets
//are held over commit by default
Statement s4 = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, 
s4.execute("set schema 'SAMP'");
ResultSet scroller=s4.executeQuery(
    "SELECT sales_person, region, sales FROM sales " +
    "WHERE sales > 8 ORDER BY sales DESC");
if (scroller.first()) { // One row is now materialized
    System.out.println("The sales rep who sold the highest number" +
                       " of sales is " +
} else {
    System.out.println("There are no rows.");
scroller.afterLast();   // By calling afterlast(), all rows will be materialized
if (!scroller.isAfterLast()) {
    System.out.println("The employee with the third highest number " +
                       "of sales is " +
                       scroller.getString("SALES_PERSON") + ", with " +
                       scroller.getInt("SALES") + " sales");
if (scroller.isLast()) {
    System.out.println("There are only three rows.");
if (scroller.last()) {
    System.out.println("The least highest number " +
                       "of sales of the top three sales is: " +
System.out.println("Closed connection");