updateBlob()-example?

From: Guido Fiala <guido(dot)fiala(at)dka-gmbh(dot)de>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: updateBlob()-example?
Date: 2004-02-12 08:24:10
Message-ID: 200402120924.10554.guido.fiala@dka-gmbh.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hallo together,

maybe someone can help - i can get updateBlob() working and i couldn't find
any working example so far.

ResultSet rs...
Blob b=getBlob(1);

works just fine, but how do i store a modified value in the database?

I tried:

bytes[] bt=...;//something binary

Blob newblob=new Blob(); //does not work, Blob is not instanciateable

//writing the "Blobs" data as byte[]-Array using

rs.updateBytes(1, bt);

//fails because it modifies the contents of the byte[], or maybe i don't
//understand what this function can be used for.

Blob b=rs.getBlob(1);

// throws null-pointer for insertRow and "wrong format for integer" for
// updateRow, although row "1" is definitely an varchar-column

b.setBytes(0,bt); //could not test because of above
rs.updateBlob(b);// dito

What is the right (and efficient) way to do this?

Guido

remark: as the large-object table is named to be a "potential security leak"
as all user have the right to read from it, i like to store values for
(middle sized) objects directly in my tables.

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Xavier Maysonnave 2004-02-12 08:52:40 License
Previous Message Oliver Jowett 2004-02-12 05:15:12 Re: closing statements when connection is closed