pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rob Kirkbride <rob@rkcomputing.co.uk>
To: Kris Jurka <books@ejurka.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Bug with blobs?
Date: Thu, 11 Aug 2005 20:55:51 +0100
Message-ID: <42FBAD47.5010403@rkcomputing.co.uk> (raw)
In-Reply-To: <Pine.BSO.4.62.0508111334440.10158@leary.csoft.net>
References: <42FB946C.2090603@rkcomputing.co.uk>
	<Pine.BSO.4.62.0508111334440.10158@leary.csoft.net>

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





view thread (3+ messages)

Message-ID: <42FBAD47.5010403@rkcomputing.co.uk>
Permalink:  ../42FBAD47.5010403@rkcomputing.co.uk/
Also on:    postgresql.org/message-id/42FBAD47.5010403@rkcomputing.co.uk

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: rob@rkcomputing.co.uk, books@ejurka.com
  Subject: Re: Bug with blobs?
  In-Reply-To: <42FBAD47.5010403@rkcomputing.co.uk>
  References: <42FB946C.2090603@rkcomputing.co.uk> <Pine.BSO.4.62.0508111334440.10158@leary.csoft.net> <42FBAD47.5010403@rkcomputing.co.uk>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox