aspose file tools
The moose likes JDBC and Relational Databases and the fly likes ResultSet object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "ResultSet object " Watch "ResultSet object " New topic

ResultSet object

L. Riley

Joined: Mar 20, 2001
Posts: 28
How do I retrieve the number of records in a ResultSet?
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
You can do a select count(*) on the querry you plan to execute, or if your are usung JDBC 2.0 you can move to the last row in your resultset using yourresultsetobject.last() and then get your record count based fo the row number.
You may want to do a search in the JDBC forum. It has been discussed there several times.
SCJP for the Java� 2 Platform

So much trouble in the world -- Bob Marley
Matthew Phillips
Ranch Hand

Joined: Mar 09, 2001
Posts: 2676
This is more appropriate for the JDBC forum. I will move it there for you.
Matthew Phillips

Matthew Phillips
jQuery in Action, 2nd edition
subject: ResultSet object