| Author |
ResultSet
|
phani kon
Ranch Hand
Joined: Apr 06, 2005
Posts: 251
|
|
What is the other alternative method for finding the number of records in the result set without using while(rs.next) { ;; }
|
 |
Stan James
(instanceof Sidekick)
Ranch Hand
Joined: Jan 29, 2003
Posts: 8791
|
|
I think JDBC deliberately did not give us an API for that because it would force the resultset to retrieve all the rows for counting. The number could be high enough to be a serious performance drag. Under normal use the resulset retrieves some number of rows at a time as you move the cursor into them, but not all of at once. A common suggestion is to run one query to select count and another to select the rows. What do you want to do with the total number? Maybe we can figure out a way to live without it.
|
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
|
 |
phani kon
Ranch Hand
Joined: Apr 06, 2005
Posts: 251
|
|
|
Thanks for your reply. But do you have any other method like scrollable result set..?
|
 |
Stan James
(instanceof Sidekick)
Ranch Hand
Joined: Jan 29, 2003
Posts: 8791
|
|
|
There are probably some SQL tricks ... select an extra computed column that is row number and sort descending so the first row has the row count. I'd still be more interested in making the requirement for row count go away.
|
 |
 |
|
|
subject: ResultSet
|
|
|