[postgis-users] JDBC OutofMemoryError

Markus Schaber schabi at logix-tt.com
Mon Aug 8 02:59:56 PDT 2005


Hi, Akira,

Akira Komo wrote:

> I tried to give more memory to Java Virtual Machine, It doesn't help. I
> think a JDBC driver should not depend on the size of a ResultSet,
> otherwise how I can fetch all the records from a huge database. I wrote
> a JDBC driver for a previous project before. Actually we have a buffer
> at the client side, each time only 256 records were downloaded from
> the server, when a user calls next() 256 times, we download another
> chunk records of 256 records into the buffer. So no matter how large the
> resultset is, it doesn't matter at the client side. At least no
> OutOfMemoryError unless the resultset has thousands columns, :).

Hi,

The pgjdbc driver is able to to the same, at least if you use later 8.0
builds (which run fine against older PostgreSQL servers, btw).

However, there need some precautions to be taken: The resultSet has to
be forward_only, setFetchSize() has to be used to set a reasonable fetch
size, and autocommit has to be set to off.

The exact discussion of those limitations was several times on the
pgjdbc list pgsql-jdbc at postgresql.org and a search in the archives
should revail the details.

HTH,
Markus



More information about the postgis-users mailing list