aspose file tools*
The moose likes JDBC and the fly likes total records in a result set Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "total records in a result set" Watch "total records in a result set" New topic

total records in a result set

ali farid
Ranch Hand

Joined: Aug 26, 2000
Posts: 60
How to get the total no. of records present in a resultset?
and is there any limit on the number of records in a resultset?
David Freels
Ranch Hand

Joined: Feb 01, 2001
Posts: 102
Use ResultSet.last() which will move to the last row and then use ResultSet.getRow() which will return the row number (number of rows). This is available in JDBC 2.0 and above, and this cannot be a FORWARD_ONLY cursor.
Hope this helps.
It is sorta covered in the JavaRanch Style Guide.
subject: total records in a result set
Similar Threads
ResulSet Count
Resultset display
ResultSet Manipulation
ResultSet object
Is it possible to get rowCount from ResultSet Object?