This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes retruring recordset to beginning Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
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
Similar Threads
Reading Socket!!
Indian Edition - Java/J2EE Job Interview Companion
HTML -> Servlet -> java bean -> JSP
resultset and .first() query
Counting number of records in result set