Streaming Blobs in PG 8.3

Поиск
Список
Период
Сортировка
Искать

Streaming Blobs in PG 8.3

От:
David Wall <d.wall@computer.org>
Дата:
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

FAQ