• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to find the number of rows in a Resultset object

 
ramchander yshetti
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am facing a problem in finding how to know the number of rows/records in a Resultset object.

Plz. give the possible ways other than using a counter variable and incrementing in while we traverse the resultset using a loop.

Bye
Ramchander
 
fred Joly
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
last() : Moves the cursor to the last row in this ResultSet object.
getRow() : Retrieves the current row number.

regards
 
Naseem Khan
Ranch Hand
Posts: 809
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


regards


Naseem Khan
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 35977
422
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ramchander,
For a more detailed explanation, take a look at the first FAQ.
 
Scott Selikoff
author
Bartender
Posts: 4033
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In general you can't. Sometimes the driver and dbms support it but even it were to, you might be sacraficing portability.
 
Naseem Khan
Ranch Hand
Posts: 809
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Scott,

Its not the question of dbms.

Once you get the result in a ResultSet, now the question is whether your JDBC driver support Scrollable ResultSet or not.

Regards

Naseem
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!