Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Interfaces Jdbc > Re: BLOB is rea...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 2 Topic 1944 of 2064
Post > Topic >>

Re: BLOB is read into memory instead of streaming (bug?)

by books@[EMAIL PROTECTED] (Kris Jurka) Apr 30, 2008 at 10:43 PM

On Wed, 30 Apr 2008, Andrew Perepelytsya wrote:

> I'm trying to stream a BLOB from the database, and expected to get it
> via rs.getBinaryStream(1), but the execution fails without reaching
> this point:
>
> org.postgresql.util.PSQLException: Ran out of memory retrieving query
> results.
> Exception: java.lang.OutOfMemoryError: Java heap space
> Stack Trace:
> java.lang.OutOfMemoryError: Java heap space
> 	at org.postgresql.core.PGStream.ReceiveTupleV3(PGStream.java:349)
>
> CREATE TABLE jackrabbit_x0020_core_binval
> (
>  binval_id character varying NOT NULL,
>  binval_data bytea NOT NULL
> )
> WITH (OIDS=FALSE);
>
>
> The expected behavior is to execute a statement and get a ref to the
> blob's stream, read it from there, which doesn't work yet
> unfortunately.
>

There are two methods to store binary data in pg and they have different 
access methods and performance characteristics.  Bytea data is expected to

be shorter and is returned in whole with a ResultSet by the server.  For 
larger data you want to use large objects which return a pointer (oid) to 
the actual data which you can then stream from the server at will.

This page describes some of the differences between the two and 
demonstrates using a pg specific api to access large objects, but 
getBlob/setBlob will work just fine.

http://jdbc.postgresql.org/do***entation/83/binary-data.html

Kris Jurka

-- 
Sent via pgsql-jdbc mailing list (pgsql-jdbc@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc
 




 2 Posts in Topic:
BLOB is read into memory instead of streaming (bug?)
Andrew Perepelytsya <a  2008-04-30 12:27:50 
Re: BLOB is read into memory instead of streaming (bug?)
books@[EMAIL PROTECTED]   2008-04-30 22:43:00 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Oct 13 2:17:38 CDT 2008.