setBinary getBinary not the same

From: "Dirk Bromberg" <bromberg(at)tzi(dot)de>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: setBinary getBinary not the same
Date: 2003-03-04 19:33:59
Message-ID: 001101c2e285$01506950$24ddfea9@xbserv
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dirk Bromberg 2003-03-04 20:01:32 Re: Testcase for bytea datatype
Previous Message Joe Howes 2003-03-04 19:17:37 Tips for PostgreSQL and Sun ONE Application Server