X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AE38952D26 for ; Thu, 11 Aug 2005 16:55:56 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 12310-01 for ; Thu, 11 Aug 2005 19:55:52 +0000 (GMT) Received: from mra03.ch.as12513.net (mra03.ch.as12513.net [82.153.252.25]) by svr1.postgresql.org (Postfix) with ESMTP id EB4D552B99 for ; Thu, 11 Aug 2005 16:55:51 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mra03.ch.as12513.net (Postfix) with ESMTP id 6D020D4510; Thu, 11 Aug 2005 20:55:52 +0100 (BST) Received: from mra03.ch.as12513.net ([127.0.0.1]) by localhost (mra03.ch.as12513.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 10535-01-45; Thu, 11 Aug 2005 20:55:52 +0100 (BST) Received: from [10.0.0.1] (unknown [81.5.146.249]) by mra03.ch.as12513.net (Postfix) with ESMTP id C0ACCD41FB; Thu, 11 Aug 2005 20:55:51 +0100 (BST) Message-ID: <42FBAD47.5010403@rkcomputing.co.uk> Date: Thu, 11 Aug 2005 20:55:51 +0100 From: Rob Kirkbride User-Agent: Mozilla Thunderbird 1.0.6-1.4.1.centos4 (X11/20050721) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Kris Jurka Cc: pgsql-jdbc@postgresql.org Subject: Re: Bug with blobs? References: <42FB946C.2090603@rkcomputing.co.uk> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by Eclipse VIRUSshield at eclipse.net.uk X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=[none] X-Spam-Level: X-Archive-Number: 200508/84 X-Sequence-Number: 13653 Kris Jurka wrote: > > > On Thu, 11 Aug 2005, Rob Kirkbride wrote: > >> I was getting an exception thrown when using Hibernate to read blobs but >> I've pared it down to something very simple - hopefully it's just >> something silly. >> >> String query = "select imageblob from tempimages where id=1"; >> >> java.sql.Blob blob = rs.getBlob("imageblob"); >> >> It throws a >> org.postgresql.util.PSQLException: Bad value for type int : >> \377\330\377\340\000 .... >> at >> org.postgresql.jdbc2.AbstractJdbc2ResultSet.toInt(AbstractJdbc2ResultSet.java:2528) >> >> at > > > Postgresql maps Blob data to the oid datatype, not bytea. For bytea > data you should use getBytes() not getBlob. > > Kris Jurka > Thanks. It's actually being done within Hibernate so I don't have a great deal of control but I'll try using the binary type which works with bytea and hopefully will be ok. Rob