Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id C7DB0632E69 for ; Tue, 7 Apr 2009 11:09:49 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 38524-10 for ; Tue, 7 Apr 2009 11:09:37 -0300 (ADT) X-Greylist: delayed 00:06:40.283651 by SQLgrey-1.7.6 Received: from smtp104.mail.mud.yahoo.com (smtp104.mail.mud.yahoo.com [209.191.85.214]) by mail.postgresql.org (Postfix) with SMTP id 9B92D63280E for ; Tue, 7 Apr 2009 11:09:43 -0300 (ADT) Received: (qmail 41386 invoked from network); 7 Apr 2009 14:03:01 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.uk; h=Received:X-Yahoo-Newman-Property:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type; b=qU2QRZ04no8/BNlvbi51cnxt5ejEo+MoT+LONSCyH0yVWqxbEnyLzTI1d+J6cree120DQv6zp9avdWfpZ+7Td5Pdto8/l1tn/NCy+HyqDE3tIEwiFVSINbiJV7ftfruUE9RHdTuAEiovLG9YqF0QHqa4nwNTFHY+6Tmopl1whko= ; Received: from unknown (HELO ?192.168.1.2?) (mail_4brad@121.73.20.162 with plain) by smtp104.mail.mud.yahoo.com with SMTP; 7 Apr 2009 14:03:00 -0000 X-Yahoo-Newman-Property: ymail-3 Message-ID: <49DB5D63.5040103@yahoo.co.uk> Date: Wed, 08 Apr 2009 02:04:19 +1200 From: Brad Milne User-Agent: Thunderbird 2.0.0.21 (X11/20090318) MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org CC: Achilleas Mantzios Subject: Re: BLOB help - yes I've read around! References: <49DB559F.3030805@yahoo.co.uk> <200904071657.08065.achill@matrix.gatewaynet.com> In-Reply-To: <200904071657.08065.achill@matrix.gatewaynet.com> Content-Type: multipart/alternative; boundary="------------070902030007000606070405" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200904/15 X-Sequence-Number: 19462 This is a multi-part message in MIME format. --------------070902030007000606070405 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Thanks Achilleas So how do you save the bytea data? I get: Method org.postgresql.jdbc4.Jdbc4PreparedStatement.setBinaryStream(int, InputStream) is not yet implemented Achilleas Mantzios wrote: > Στις Tuesday 07 April 2009 16:31:11 ο/η Brad Milne έγραψε: > >> Hi all >> >> I'm a Java dev, new to postgres. I've just migrated an app during >> development from Derby to Postgres (due to better indexing features), >> but am very confused by the failing BLOB implementations. >> >> PostgreSQL: 8.3.7 >> PostgreSQL-JDBC: 8.3-604 >> JDK: 6 >> >> A lot of what I've seen in searches and even in the google groups page, >> seems to be related to older jdbc drivers, where BLOBs were supported, >> both for OID and bytea. I'm currently getting 'unimplemented' exceptions >> doing anything with BLOBs. >> >> My application saves sound files as byte arrays to the database. >> >> Q1: Given that it's sound and not text, would it be safe to use bytea >> given that certain characters need to be escaped? >> > > I have been storing binary data in bytea for ages with postgresql, > with no major problems. > Performance might be an issue. > It is a good practice to store along with the bytea value, > its mime type as well. > So in your binary library you could have mp3s,oggs,mpegs, ms docs, jpegs, pdfs, > and your servlet would know exactly the content type to serve to the client. > > Also to answer your question about safeness/escaping, etc... > those are taken care by the jdbc driver. > > >> Q2: How on earth do I use the BLOB methods? In particular setBlob(int >> parameterIndex, InputStream inputStream) and/or createBlob() and >> setBlob(int parameterIndex, Blob x)? >> >> > > I never did anything with BLOBs so no experience from me here. > > >> Thanks a lot >> Brad >> >> > > > > --------------070902030007000606070405 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks Achilleas

So how do you save the bytea data? I get:
Method org.postgresql.jdbc4.Jdbc4PreparedStatement.setBinaryStream(int, InputStream) is not yet implemented



Achilleas Mantzios wrote:
Στις Tuesday 07 April 2009 16:31:11 ο/η Brad Milne έγραψε:
  
Hi all

I'm a Java dev, new to postgres. I've just migrated an app during 
development from Derby to Postgres (due to better indexing features), 
but am very confused by the failing BLOB implementations.

PostgreSQL: 8.3.7
PostgreSQL-JDBC: 8.3-604
JDK: 6

A lot of what I've seen in searches and even in the google groups page, 
seems to be related to older jdbc drivers, where BLOBs were supported, 
both for OID and bytea. I'm currently getting 'unimplemented' exceptions 
doing anything with BLOBs.

My application saves sound files as byte arrays to the database.

Q1: Given that it's sound and not text, would it be safe to use bytea 
given that certain characters need to be escaped?
    

I have been storing binary data in bytea for ages with postgresql,
with no major problems.
Performance might be an issue.
It is a good practice to store along with the bytea value,
its mime type as well.
So in your binary library you could have mp3s,oggs,mpegs, ms docs, jpegs, pdfs,
and your servlet would know exactly the content type to serve to the client.

Also to answer your question about safeness/escaping, etc...
those are taken care by the jdbc driver.

  
Q2: How on earth do I use the BLOB methods? In particular setBlob(int 
parameterIndex, InputStream inputStream) and/or createBlob() and 
setBlob(int parameterIndex, Blob x)?

    

I never did anything with BLOBs so no experience from me here.

  
Thanks a lot
Brad

    



  

--------------070902030007000606070405--