PreparedStatement ps = db.preparedStatement("select * from tbl");
ResultSet rs = ps.executeQuery();
while(rs.next) {
...
process(...);
...
}
PreparedStatement preparedStatement = connection.prepareStatement(query,
ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
preparedStatement.setFetchSize(fetchSize);