Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Size of ResultSet

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 527
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic