Hi Thank you for reading my post. What is fastest way to retrieve the records from ResultSet? should i create a while loop and use rs.next to find all rows or there is some other way , for example to convert the result set to a colletion / iterator? of its rows.
i do not need any metadata or other stuff that a ResultSet provide , i just need data rows.
What is fastest way to retrieve the records from ResultSet should i create a while loop and use rs.next to find all rows
or there is some other way
for example to convert the result set to a colletion / iterator? of its rows.
Filling a collection with your rows is often a good idea for other reasons but you are still using rs.next or whatever to get each row. And by whatever I mean you could use absolute or something as well or go to the end of a scrollable result set and move backwards but at the end of the day you still have to fetch all the rows using the ResultSet.
Also please don't be confused the best way by far will be next. Anything else will be slower. If performance is an issue look into manipulating the fetch size of your cursor. using a forward only read only cursor may also help and as always write good SQL... only SELECT the rows you actually need.
subject: what is fastest way to retrive rows from a resultSet?