[MonetDB-users] hold cursors over commit in JDBC
hi guys, I have a very large table, which I should scan it and generate reports. My code is like this: Class.forName("nl.cwi.monetdb.jdbc.MonetDriver"); Connection conn = DriverManager.getConnection("jdbc:monetdb://localhost/online", "monetdb", "monetdb"); conn.setAutoCommit(false); conn.setHoldability(ResultSet.HOLD_CURSORS_OVER_COMMIT); Statement stmt = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); stmt.setFetchSize(10); ResultSet rs = stmt.executeQuery("SELECT * FROM denorm"); while (rs.next()) { /* process line */ } conn.commit(); I do not use much ram inside while loop. I get OutOfMemeryException from JVM. So I think the driver ignores HOLD_CURSORS_OVER_COMMIT and fetches all records. Is there any solution?
On 11-06-2012 23:44:13 -0700, Majid Azimi wrote:
hi guys,
I have a very large table, which I should scan it and generate reports. My code is like this:
Class.forName("nl.cwi.monetdb.jdbc.MonetDriver"); Connection conn = DriverManager.getConnection("jdbc:monetdb://localhost/online", "monetdb", "monetdb");
conn.setAutoCommit(false); conn.setHoldability(ResultSet.HOLD_CURSORS_OVER_COMMIT);
Statement stmt = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); stmt.setFetchSize(10);
ResultSet rs = stmt.executeQuery("SELECT * FROM denorm");
while (rs.next()) { /* process line */ }
conn.commit();
I do not use much ram inside while loop. I get OutOfMemeryException from JVM. So I think the driver ignores HOLD_CURSORS_OVER_COMMIT and fetches all records. Is there any solution?
HOLD_CURSORS_OVER_COMMIT means it keeps the cursor open, right? So what else can the driver do but keep them open (including the memory associated to that)? What would you have expected to happen with this setting? Fabian
participants (2)
-
Fabian Groffen
-
Majid Azimi