ResultSet & setFetchSize fails to stop heap failures

From: "U(dot) George" <netbeans(at)gatworks(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: ResultSet & setFetchSize fails to stop heap failures
Date: 2008-05-28 19:09:47
Message-ID: 483DADFB.7010204@gatworks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

The resultset is a very large set of rows ( each row 2 ints and a
bunch of doubles ) . I am unable to convince jdbc to fetch one row at
a time, and avoid the heap failure.
Is there a way, or just a bug, or feature deficiency?

String s = "Select tzids, tzide, latlonpoints from " + tableName;
ResultSet rSet;
try {
Statement select = sqlConnection.createStatement(
ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
select.setFetchSize( 1 );
rSet = select.executeQuery(s); <==========================
rSet.setFetchSize(1);
} catch ( Exception e ) { e.printStackTrace(); rSet = null; }

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1309)
at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:192)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:451)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:336)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:235)
at UpdateNodeNumbers.getAllTzid(UpdateNodeNumbers.java:78)
at UpdateNodeNumbers.<init>(UpdateNodeNumbers.java:34)
at TestShapefile.test(TestShapefile.java:63)
at TestShapefile.main(TestShapefile.java:50)

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2008-05-28 19:34:34 Re: ResultSet & setFetchSize fails to stop heap failures
Previous Message Tom Lane 2008-05-28 14:24:51 Re: [HACKERS] How embarrassing: optimization of a one-shot query doesn't work