Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is it possible to get rowCount from ResultSet Object?

 
Thennam Pandian
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Consider I am executing the following query.



and i want to get the total number of records from resultSet Object.

 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34973
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have two options. One is to run select count(*) from table. The other is to loop through the result set and count as you go.
 
Mohamed Sanaulla
Saloon Keeper
Posts: 3159
33
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think even getFetchSize returns the number of rows fetched by the ResultSet.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34973
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mohamed sanaullah wrote:I think even getFetchSize returns the number of rows fetched by the ResultSet.

No. It returns the number of rows fetched at a time. It does not return the total number of records.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic