pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Wall <d.wall@computer.org>
To: pgsql-jdbc <pgsql-jdbc@postgresql.org>
Subject: JDBC Blob helper class & streaming uploaded data into PG
Date: Wed, 04 Feb 2009 11:18:26 -0800
Message-ID: <4989EA02.5020703@computer.org> (raw)

Does anybody have a JDBC Blob helper class so we can use the 
setBlob()/getBlob() calls in JDBC for PG 8.3?  It would be a class that 
implements the java.sql.Blob interface.

Does anybody have any code samples of how I'd go about reading a file in 
blocks, compressing the block and then streaming that block into a Blob 
(LO)?  We are starting to process very large files uploaded in a web app 
and so it's no longer possible to keep it all in memory before it's 
stored in PG.

The pseudo-code is something like:

while ( hasMoreHttpPostData )
{
  read chunk from HTTP POST
  compress chunk
  write chunk to DB
}

If possible, we'd like to use a streaming cipher (for encryption) and 
GZIP to write the compressed data and a Blob to store to the database. 

Do these APIs support writing chunks, or must we actually loop through 
each byte (which seems painfully slow).

Thanks,
David



view thread (3+ messages)  latest in thread

Message-ID: <4989EA02.5020703@computer.org>
Permalink:  ../4989EA02.5020703@computer.org/
Also on:    postgresql.org/message-id/4989EA02.5020703@computer.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: d.wall@computer.org
  Subject: Re: JDBC Blob helper class & streaming uploaded data into PG
  In-Reply-To: <4989EA02.5020703@computer.org>
  References: <4989EA02.5020703@computer.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox