Commit 1b647cf8 authored by Matija Obreza's avatar Matija Obreza

Scrollable JDBC resultset

parent fdcc0a1c
......@@ -20,14 +20,14 @@ public class JdbcRowReader implements RowReader {
private ResultSet res;
private int columnCount;
public JdbcRowReader(String query,DatabaseSettings databaseSettings) {
public JdbcRowReader(String query, DatabaseSettings databaseSettings) {
this.query = query;
String url =databaseSettings.getUrl();
String driver =databaseSettings.getDriverClassName();
String user =databaseSettings.getUser();
String password =databaseSettings.getPassword();
String url = databaseSettings.getUrl();
String driver = databaseSettings.getDriverClassName();
String user = databaseSettings.getUser();
String password = databaseSettings.getPassword();
try {
this.conn = ConnectionUtils.getConnection(driver,url, user, password);
this.conn = ConnectionUtils.getConnection(driver, url, user, password);
} catch (ClassNotFoundException e) {
} catch (SQLException e) {
}
......@@ -38,8 +38,8 @@ public class JdbcRowReader implements RowReader {
public List<Object[]> readRows(int rowsToRead) throws IOException {
try {
if (this.preparedStatement == null) {
this.preparedStatement = conn.prepareStatement(query);
preparedStatement.setFetchSize(rowsToRead);
this.preparedStatement = conn.prepareStatement(query, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
preparedStatement.setFetchSize(Integer.MIN_VALUE);
this.res = preparedStatement.executeQuery();
ResultSetMetaData metadata = res.getMetaData();
this.columnCount = metadata.getColumnCount();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment