getBinaryStream and OutOfMemoryException

From: Jesper Thorhauge <jth(at)conzentrate(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: getBinaryStream and OutOfMemoryException
Date: 2005-06-28 08:15:31
Message-ID: 42C10723.5010702@conzentrate.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hi

I have a problem when retreiving relative large files from a bytea field
in the
database using getBinaryStream.

ResultSet res....
InputStream is = res.getBinaryStream("largefile_bytea");

causes OutOfMemoryException...

setBinaryStream also used to cause this problem but seems to be fixed
with the
8.0-release of the jdbc driver ( thanks!!! :-) ).

Whenever i use getBinaryStream on a file of size 9mb or larger it runs
out of
memory. I know i can just raise jvm heap using -Xmx, but it seems to me like
the streaming feature doesn't work properly. Looking into the cvs
checkout from
22-05-2005, it really seems to me that getBinaryStream is nothing more
than a
getBytes ...?? Searching the mailing list archive didn't give me the
answer, so
i hope someone out there is able to provide it.

My setup is;

- postgresql-8.0-311.jdbc3 driver
- postgresql 8.0
- jboss/tomcat using hibernate
- running on windows xp with jdk 1.5.0_02-b09

Regards
Jesper Thorhauge

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2005-06-28 13:06:13 Re: getBinaryStream and OutOfMemoryException
Previous Message Enrique Ibarra 2005-06-27 18:22:11 Re: Problems loading the driver