jQuery in Action, 3rd edition
The moose likes JDBC and Relational Databases 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
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
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.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: total records in a result set
It's not a secret anymore!