A ResultSet
object that is not scrollable can use only the next
method to move its cursor forward, and it can move the cursor only forward from the first row to the last row. A default JdbcRowSet
object, however, can use all of the cursor movement methods defined in the ResultSet
interface.
A JdbcRowSet
object can call the method next
, and it can also call any of the other ResultSet
cursor movement methods. For example, the following lines of code move the cursor to the fourth row in the jdbcRs
object and then back to the third row:
jdbcRs.absolute(4); jdbcRs.previous();
The method previous
is analogous to the method next
in that it can be used in a while
loop to traverse all of the rows in order. The difference is that you must move the cursor to a position after the last row, and previous
moves the cursor toward the beginning.
No comments:
Post a Comment