Java Reference
In-Depth Information
plication that allows for someone to display the first or last record that was retrieved, or
perhaps page forward or backward through results. You could not do this very easily
using a standard ResultSet . However, by creating a scrollable ResultSet , you
can easily move backward and forward through the results.
To create a scrollable ResultSet , you must first create an instance of a State-
ment or PreparedStatement that has the ability to create a scrollable Res-
ultSet . That is, when creating the Statement , you must pass the ResultSet
scroll type constant value to the Connection object's createStatement()
method. Likewise, you must pass the scroll type constant value to the Connection
object's prepareStatement() method when using a PreparedStatement .
There are three scroll type constants that can be used. Table 13-1 displays those three
constants.
Table 13-1 . ResultSet Scroll Type Constants
Constant
Description
Default type,
allows for-
ward move-
ment only.
ResultSet.TYPE_FORWARD_ONLY
Allows for-
ward and
backward
movement.
Not sensitive
to Res-
ultSet up-
dates.
ResultSet.TYPE_SCROLL_INSENSITIVE
ResultSet.TYPE_SCROLL_SENSITIVE
Allows for-
ward and
backward
movement.
Sensitive to
ResultSet
updates.
You must also pass a ResultSet concurrency constant to advise whether the
ResultSet is intended to be updatable. The default is Res-
ultSet.CONCUR_READ_ONLY , which means that the ResultSet is not updat-
 
 
Search WWH ::




Custom Search