posted 25 years ago
I am writing a program which will query a database and return the results to a resultset. I am using a PreparedStatement object which runs the query and populates the resultset.
Then I loop through the resultset and store values returned for each row.
The code I use:-
rs = stmt.executeQuery();
while(rs.next)
{
aVariable = rs.getString(1);
}
The problem is that the while loop is extremely slow.
(the # of records is 20,000 in the database).
Is there a better way to loop through the recordset ?
Also, the executeQuery always returns a forward only recordset. How can one get a recordset with which one can use rs.last(),rs.first() or rs.movetoCurrentRow() etc.
Thanks in advance.