public static void scrollResultSet(ResultSet rs, int rowNumber) throws SQLException {
        // If the driver supports scrollable result sets, use that feature.
        if (isScrollResultsSupported()) {
            if (rowNumber > 0) {
                // We will attempt to do a relative fetch. This may fail in SQL Server if
                // <resultset-navigation-strategy> is set to absolute. It would need to be
                // set to looping to work correctly.
                // If so, manually scroll to the correct row.
                try {
                    rs.setFetchDirection(ResultSet.FETCH_FORWARD);
                    rs.relative(rowNumber);
                }
                catch (SQLException e) {
                    // TODO change "Error ..." to "Disabling ..."
                    Log.error("Error in JDBC method rs.relative(rowNumber).", e);
                    //Log.error("Disabling JDBC method rs.relative(rowNumber).", e);
                    //scrollResultsSupported = false;
                    for (int i = 0; i < rowNumber; i++) {
                        rs.next();
                    }
                }
            }
        }
        // Otherwise, manually scroll to the correct row.
        else {
            for (int i = 0; i < rowNumber; i++) {
                rs.next();
            }
        }
    }
Scrolls forward in a result set the specified number of rows. If the JDBC driver
supports the feature, the cursor will be moved directly. Otherwise, we scroll
through results one by one manually by calling {@code rs.next()}.

@param rs the ResultSet object to scroll.
@param rowNumber the row number to scroll forward to.
@throws SQLException if an error occurs.
xmppserver/src/main/java/org/jivesoftware/database/DbConnectionManager.java