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 Iterating resultset 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 "Iterating resultset" Watch "Iterating resultset" New topic

Iterating resultset

Prasath Premkumar
Ranch Hand

Joined: Nov 13, 2008
Posts: 43

Hi all,

I have a confusion about iterating resultset.

If the above code segment checks for empty resultsets too, then whats the advantage of using,

Can anyone please explain this and what is the best way to do the iterating part?

Thanks in advance.
Christophe Verré

Joined: Nov 24, 2005
Posts: 14687

Calling first() allow you to move the cursor back to the ResultSet. This could be useful if you are using the same ResultSet somewhere else, and you want to reiterate from the start. If you don't, then you don't need to use first().

[My Blog]
All roads lead to JavaRanch
I agree. Here's the link:
subject: Iterating resultset
Similar Threads
Resulset performance problem.
Java Mail taking more time
How to write to new table?
Behaviour of ResultSet