This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes Determine Rows in a ResultSet? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Determine Rows in a ResultSet?" Watch "Determine Rows in a ResultSet?" New topic

Determine Rows in a ResultSet?

Amond Adams
Ranch Hand

Joined: Nov 28, 2000
Posts: 62
Hey Dudes,
Lets say stmt.setFetchSize(100) is executed and then ResultSet forms as a reult of a executeQuery() not if the query only returned 10 or 20 rows, whats the cleanist way to determine the actual number of rows present in the ResultSet at any valid instance.
Love and Peace.
Rani Mukherjee

Joined: Jan 14, 2001
Posts: 24
I asked similar quest & found answer in same forum. You can view this at
Bhupinder Dhillon
Ranch Hand

Joined: Oct 12, 2000
Posts: 124
You could create a scrollable result set and jump to the last row and call getRow() method which returns the number of the current row (in this case last row).
I agree. Here's the link:
subject: Determine Rows in a ResultSet?
It's not a secret anymore!