updateBlob()-example? - Mailing list pgsql-jdbc

From Guido Fiala
Subject updateBlob()-example?
Date
Msg-id 200402120924.10554.guido.fiala@dka-gmbh.de
Whole thread Raw
Responses Re: updateBlob()-example?
List 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.


pgsql-jdbc by date:

Previous
From: Oliver Jowett
Date:
Subject: Re: closing statements when connection is closed
Next
From: Kris Jurka
Date:
Subject: Re: updateBlob()-example?