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 Resultset Size 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 "Resultset Size" Watch "Resultset Size" New topic
Author

Resultset Size

David Chan
Greenhorn

Joined: Apr 19, 2001
Posts: 21
How can I check to size of the resultset or no. of row return without traversing the whole resultset?
David Chan
Simon Xu
Ranch Hand

Joined: Aug 16, 2000
Posts: 235
You can do select count (*) from .... before actually get your ResultSet.
Regards
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Originally posted by David Chan:
How can I check to size of the resultset or no. of row return without traversing the whole resultset?

If you have a JDBC 2.0 scrollable result set, you should be able to go to the last row (last()) and then get the current row number (getRow()). I'm not sure if that would be more efficient than doing a count(*) query first or not - give it try and tell us what you found.
- Peter
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Resultset Size
 
Similar Threads
How to find the size of my resultSet
Paging retrieve data question
Resultset Paging
No size method in ResultSet
resultset size