Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 9B50D632E69 for ; Tue, 7 Apr 2009 10:57:26 -0300 (ADT) 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 99644-03 for ; Tue, 7 Apr 2009 10:57:24 -0300 (ADT) Received: from mx1.hub.org (mx1.hub.org [200.46.208.106]) by mail.postgresql.org (Postfix) with ESMTP id 4E5A863280E for ; Tue, 7 Apr 2009 10:57:25 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smadev.internal.net (host3.dynacom.ondsl.gr [62.103.35.211]) by mx1.hub.org (Postfix) with ESMTP id 7D319125A6C9 for ; Tue, 7 Apr 2009 10:57:21 -0300 (ADT) Received: from smadev.internal.net (localhost [127.0.0.1]) by smadev.internal.net (8.14.2/8.14.2) with ESMTP id n37Dv9JB062285; Tue, 7 Apr 2009 16:57:09 +0300 (EEST) (envelope-from achill@matrix.gatewaynet.com) Received: from localhost (localhost [[UNIX: localhost]]) by smadev.internal.net (8.14.2/8.14.2/Submit) id n37Dv8Ub062284; Tue, 7 Apr 2009 16:57:08 +0300 (EEST) (envelope-from achill@matrix.gatewaynet.com) From: Achilleas Mantzios Organization: Dynacom Tankers Mgmt To: pgsql-jdbc@postgresql.org Subject: Re: BLOB help - yes I've read around! Date: Tue, 7 Apr 2009 15:57:07 +0200 User-Agent: KMail/1.9.7 Cc: Brad Milne References: <49DB559F.3030805@yahoo.co.uk> In-Reply-To: <49DB559F.3030805@yahoo.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200904071657.08065.achill@matrix.gatewaynet.com> 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: 200904/13 X-Sequence-Number: 19460 =CE=A3=CF=84=CE=B9=CF=82 Tuesday 07 April 2009 16:31:11 =CE=BF/=CE=B7 Brad = Milne =CE=AD=CE=B3=CF=81=CE=B1=CF=88=CE=B5: > Hi all >=20 > I'm a Java dev, new to postgres. I've just migrated an app during=20 > development from Derby to Postgres (due to better indexing features),=20 > but am very confused by the failing BLOB implementations. >=20 > PostgreSQL: 8.3.7 > PostgreSQL-JDBC: 8.3-604 > JDK: 6 >=20 > A lot of what I've seen in searches and even in the google groups page,=20 > seems to be related to older jdbc drivers, where BLOBs were supported,=20 > both for OID and bytea. I'm currently getting 'unimplemented' exceptions= =20 > doing anything with BLOBs. >=20 > My application saves sound files as byte arrays to the database. >=20 > Q1: Given that it's sound and not text, would it be safe to use bytea=20 > 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, p= dfs, 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=20 > parameterIndex, InputStream inputStream) and/or createBlob() and=20 > setBlob(int parameterIndex, Blob x)? >=20 I never did anything with BLOBs so no experience from me here. > Thanks a lot > Brad >=20 =2D-=20 Achilleas Mantzios