Re: setBinary getBinary not the same

From: "Dirk Bromberg" <bromberg(at)tzi(dot)de>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: setBinary getBinary not the same
Date: 2003-03-05 18:28:40
Message-ID: 000a01c2e345$0c2a69f0$24ddfea9@xbserv
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Ok,

the error must be at retrieving the bytes from the db.

if i insert and retrieve byte[]s with the pg72 jar ist works.
and if i insert byte[]s with pg73 and retrieve with 72 it works.
and if i insert byte[]s with pg72 and retrive with 73 it doesn't work.

any ideas ?

Dirk Bromberg

-----Ursprüngliche Nachricht-----
Von: pgsql-jdbc-owner(at)postgresql(dot)org
[mailto:pgsql-jdbc-owner(at)postgresql(dot)org] Im Auftrag von Dirk Bromberg
Gesendet: Dienstag, 4. März 2003 20:34
An: pgsql-jdbc(at)postgresql(dot)org
Betreff: [JDBC] setBinary getBinary not the same

Hi,

i've same problem like Uwe.

table is :

ico_binary(int4, bytea)

when i use to store:

PreparedStatement addico = con.prepareStatement("INSERT INTO ico_binary
(id, bin) VALUES (?,?)");
addico.setInt(1, icoID);
addico.setBytes(2, ico_bytes);
addico.executeUpdate();
addico.close();

and then retrive:

Statement getico = con.createStatement();
ResultSet res = getico.executeQuery("select id, bin from
ico_binary where id="+IcoId);
if(!res.next()){
throw new IcoNotFoundException("can't find ico with
id: "+IcoId);
}else{
byte[] ico_bytes = res.getBytes("bin");

The Problem :

the ico_bytes.lenght before: 2435 and after: 2501

What is going on there ?

greets

Dirk Bromberg

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dennis R. Gesker 2003-03-05 21:19:26 getGeneratedKeys()
Previous Message Dave Cramer 2003-03-05 17:17:29 Re: troubleshooting suggestions requested