File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes retruring recordset to beginning Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "retruring recordset to beginning" Watch "retruring recordset to beginning" New topic

retruring recordset to beginning

dale conn
Ranch Hand

Joined: Jun 16, 2006
Posts: 57
hi all,

i have this code

rs = stmt.executeQuery(sql);

while (

after processing the while loop, how do i return the rs back to the beginning?

thanks for any help
aslam parveez
Ranch Hand

Joined: Apr 25, 2006
Posts: 47
If you are using jdbc2.0 then your result set can be scrollable result set.
And if you create a scrollable result set then you can move around the resultset pointer wherever needed like calling rs.first() will take the resultset pointer to the first record.
dale conn
Ranch Hand

Joined: Jun 16, 2006
Posts: 57

stmt = conn.createStatement(rs.TYPE_SCROLL_INSENSITIVE, rs.CONCUR_READ_ONLY);
I agree. Here's the link:
subject: retruring recordset to beginning
It's not a secret anymore!