JDBC Tutorial
ResultSet Object is a container for given SQL Query. It contains SQL Query Data, and also describing each column(i.e metadata). By Default ResultSet rows navigates in Forward Directions, and it also possible to make ResultSet rows scrollable in Forward or Reverse Direction or moving to exact position etc.,. This is possible changing perameters at CreateStatement or Prepared Statement methods.
CreateStatement method in Connection Object has 3 overloaded methodsCreateStatement without parameters is equal to createStatement(ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_READ_ONLY) JDBC driver implicitely uses these paramater values.
Programmer can explicitely pass ResultSetType and ResultSetConcurrency, for forward or backward direction.
In this method, apart from resultset type and concurrency, programmer can set Holdability.
Note: Same parameters applies to connection Object's PreparedStatement
ResultSet Type | Remarks |
ResultSet.TYPE_FORWARD_ONLY | Result Set Object is read only.Cusror with in the Resultset moves only forward direction. |
ResultSet.TYPE_SCROLL_INSENSITIVE | Result Set Object is scrollable and Data with in ResultSet not updatable |
ResultSet.TYPE_SCROLL_SENSITIVE | Result Set Object is scrollable and Data with in ResultSet may be updatable |
resultSetConcurrency a concurrency type; one of ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE
ResultSet Concurrency Type | Remarks |
ResultSet.CONCUR_READ_ONLY | Result Set Object is read only.Cusror with in the Resultset moves only forward direction. |
ResultSet.CONCUR_UPDATABLE | Result Set Object is scrollable and Data with in ResultSet updatable |
ResultSet Holdability Type | Remarks |
ResultSet.CLOSE_CURSORS_AT_COMMIT | If ResultSets with this Holdability, will be closed on committing the transaction |
ResultSet.HOLD_CURSORS_OVER_COMMIT | If ResultSets with this Holdability, will be open on committing the transaction |
boolean previous() boolean first() boolean last() boolean absolute(int row) boolean relative(int rows) void afterLast() void afterLast() void beforeFirst() void moveToCurrentRow() void moveToInsertRow() boolean isFirst() boolean isBeforeFirst() boolean isLast() boolean isAfterLast() int getRow() deleterow updaterow insertrow cancelupdaterow
ADS