Re: OutOfMemoryError - Mailing list pgsql-jdbc

From Marc Herbert
Subject Re: OutOfMemoryError
Date
Msg-id 877je4o99z.fsf@meije.emic.fr
Whole thread Raw
In response to OutOfMemoryError  (rstepha1@nycap.rr.com)
List pgsql-jdbc
rstepha1@nycap.rr.com writes:

> It seems that the ResultSet is containing the entire selected set of
> data and not using a cursor within the database engine.  I have tried
> setting the resultSetType and resultSetConcurrency to TYPE_FORWARD_ONLY
> and CONCUR_READ_ONLY respectively to hopefully force the cursor
> management to be server oriented, without success.
>
> It is possible to work around by increasing the heap size or lowering
> the selection criteria, but ...
>
> How do you get the driver to not retrieve all of the data into the
> ResultSet?  Is there a setting either within the JDBC driver, or at the
> database that would determine caching X number of rows returned at a time?

Try this:

   myStatement.setFetchSize(43);

Warning: according to the JDBC spec, it's just a "hint", the driver
may still do what it thinks is good.




pgsql-jdbc by date:

Previous
From: Kris Jurka
Date:
Subject: Re: username and password for postgresql jdbc FTP site
Next
From: Oliver Jowett
Date:
Subject: Re: NullPointerException when calling ResultSet.absolute(int)