getBinaryStream and OutOfMemoryException - Mailing list pgsql-jdbc

From Jesper Thorhauge
Subject getBinaryStream and OutOfMemoryException
Date
Msg-id 42C10723.5010702@conzentrate.com
Whole thread Raw
Responses Re: getBinaryStream and OutOfMemoryException
List 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

pgsql-jdbc by date:

Previous
From: Enrique Ibarra
Date:
Subject: Re: Problems loading the driver
Next
From: Oliver Jowett
Date:
Subject: Re: getBinaryStream and OutOfMemoryException