• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Size of ResultSet

 
Butch C
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After executing a Statement which returns a ResultSet, is
there any method to call or a way to determine how many
rows are contained in the ResultSet without looping through
the ResultSet?

I would like to know how many rows are returned prior to processing
the ResultSet.
TIA
 
Anil Vupputuri
Ranch Hand
Posts: 527
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai,
JDBC1.2 API doesnt have this functionality ,where from JDBC2.0 it provides all userfriendly methods which u can access size of the resultset.For JDBC2.0API ,JDBC-ODBC bridge wont support so go for pure Java drivers i.e., thin drivers for Oracle.
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since the ResultSet doesn't actually contain all the rows (imagine doing a select * on a table with 100 million rows) but goes back to the database to get more rows as needed, I don't believe that the ResultSet has any way of knowing the actual size of the ResultSet.
Anil, is there a particular method you had in mind?
 
Deepika Wadhwa
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
there is no way to get total row count from resultset.
but what u can do to get total no of rows returned, run a sql query before it to get count of your query.
i hope this will solve ur pb.

wishes,
Deepika
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic