The ResultSet interface represents a database result set, allowing programs to access the data in the result set. ResultSet objects are usually generated by the execute(), executeUpdate(), and executeQuery() methods of Statement and PreparedStatement. They are also returned by certain metadata methods.

The JDBC 1.0 ResultSet allows you to scroll navigate through the data once from beginning to end, iterating through rows using the next() method and retrieving individual fields using the getXXX() methods. The getMetaData() method returns a ResultSetMetaData object that describes the structure of the underlying data.

JDBC 2.0 introduces a number of new features: including complete scrolling capabilities (the previous(), first(), last(), and related methods), direct updating of data via the updateXXX() methods, and insertion of new data rows using the insertRow() method. JDBC 3.0 adds updater methods for BLOBs, CLOBs, Refs, and URL s.

public interface ResultSet {
// Public Constants
   public static final int CLOSE_CURSORS_AT_COMMIT;              // =2, 1.4
   public static final int CONCUR_READ_ONLY;                     // =1007, 1.2
   public static final int CONCUR_UPDATABLE;                     // =1008, 1.2
   public static final int FETCH_FORWARD;                        // =1000, 1.2
   public static final int FETCH_REVERSE;                        // =1001, 1.2
   public static final int FETCH_UNKNOWN;                        // =1002, 1.2
   public static final int HOLD_CURSORS_OVER_COMMIT;             // =1, 1.4
   public static final int TYPE_FORWARD_ONLY;                    // =1003, 1.2
   public static final int TYPE_SCROLL_INSENSITIVE ...

Get Java Enterprise in a Nutshell, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.