Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 1E4D7632CD3 for ; Wed, 4 Feb 2009 16:00:34 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 18816-07-2 for ; Wed, 4 Feb 2009 16:00:29 -0400 (AST) X-Greylist: delayed 00:41:57.504756 by SQLgrey-1.7.6 Received: from mail2.yozons.com (mail2.yozons.com [63.251.168.97]) by mail.postgresql.org (Postfix) with ESMTP id 30E69632CFA for ; Wed, 4 Feb 2009 16:00:20 -0400 (AST) Received: from [192.168.1.4] (pool-98-111-76-154.sttlwa.fios.verizon.net [98.111.76.154]) (authenticated bits=0) by mail2.yozons.com (8.12.10/8.12.10) with ESMTP id n14JITTL019352 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Wed, 4 Feb 2009 11:18:29 -0800 Message-ID: <4989EA02.5020703@computer.org> Date: Wed, 04 Feb 2009 11:18:26 -0800 From: David Wall Reply-To: d.wall@computer.org User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: pgsql-jdbc Subject: JDBC Blob helper class & streaming uploaded data into PG Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200902/8 X-Sequence-Number: 19283 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