Re: Bug with blobs? - Mailing list pgsql-jdbc

From Rob Kirkbride
Subject Re: Bug with blobs?
Date
Msg-id 42FBAD47.5010403@rkcomputing.co.uk
Whole thread Raw
In response to Re: Bug with blobs?  (Kris Jurka <books@ejurka.com>)
List pgsql-jdbc
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 .... <blob data removed>
>>   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



pgsql-jdbc by date:

Previous
From: "Nanu Ram"
Date:
Subject: Re: Memory leak in 8.0 JDBC driver?
Next
From: Dave Cramer
Date:
Subject: Re: Memory leak in 8.0 JDBC driver?