I\'m doing a query to retrieve a large amount of IDs (integers). Instead of iterating millions of times through the ResultSet and copying everything one-by-one to an ArrayLi
Using the Apache DbUtils library you can easily return a ResultSet as a List of Maps.
public List query(String query) {
List result = null;
try {
QueryRunner qrun = new QueryRunner();
result = (List) qrun.query(connection, query, new MapListHandler());
} catch (Exception ex) {
ex.printStackTrace();
}
return result;
}