Streaming Blobs in PG 8.3

From: David Wall <d(dot)wall(at)computer(dot)org>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Streaming Blobs in PG 8.3
Date: 2008-11-18 00:29:45
Message-ID: 49220C79.9010909@computer.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

I've been using the JDBC setBlob/getBlob routines, that wrap the PG's LO
routines I believe, for some time and they've worked great. But we've
always done it with all of the data in a byte array for storing and
retrieving.

We are looking to add a streaming capability and wanted to know what the
"best approach" would be in JDBC?

Read streaming with a Blob seems pretty straightforward since even our
byte array version calls getBinaryStream() and then reads it into the
array. But writing seems a bit less clear since I'm not sure how I get
the data into the Blob in a stream so that PG can suck it out of the
stream and write it to the database, and then how to tell my Blob that
I'm at "EOF" so that PG can also stop streaming it to the backend and
complete the LO.

I'd prefer to use pure JDBC, but is this easily accomplished (examples?)
or should I look to use the PG-specific LO routines directly in the JDBC
library?

Thanks,
David

Browse pgsql-jdbc by date

  From Date Subject
Next Message Reuben Cummings 2008-11-22 19:57:44 neooffice form problem with numerics
Previous Message Don Pannese 2008-11-17 22:13:52 Re: Java 6 support for org.postgresql.ds.PGPoolingDataSource