I am looking to be able to tell how many records, i.e., db-table rows, a jdbc query returns without iterating through the resultset.
I tried ResultSet.getFetchSize()
-- however didn't work the way I thought it would:
if (rSet.getFetchSize()==0)
System.out.println("no results returned");
while (rSet.next())
System.out.println(rSet.getString("transactionID"));
rSet.next();
The above code snippet prints the first console message, then gets into the loop and iterates to execute the second console message on 1+ results.
How to tell the number of records fetched? what's ResultSet.getFetchSize()
for?
//-----------------------------------
EDIT: looking to tell this count without any iterations on the ResultSet
. convinced that this isn't possible though. the answers to the referred Q are saying so.