Subject Re: [Firebird-Java] Blob and update pb
Author William L. Thomson Jr.
Hello,
Here is how I insert a blob

byte[] picture = // here I read the picture from a file, etc.

String sq = "INSERT INTO PICTURES (PICTURE) VALUES (?);";
PreparedStatement ps = c.prepareStatement(sq);
ps.setBytes(1,picture);
boolean result = ps.execute();
ps.close();

That works for me. You can use as many ? as you want, just reference
them in order

So you could have

String sq = "INSERT INTO PICTURES (PICTURE1,PICTURE2) VALUES (?,?);";
PreparedStatement ps = c.prepareStatement(sq);
ps.setBytes(1,picture1);
ps.setBytes(2,picture2);
boolean result = ps.execute();
ps.close();

For updates

String sq = "UPDATE GALLERY_PICTURES SET PICTURE=?";
PreparedStatement ps = c.prepareStatement(sq);
ps.setBytes(1,picture);
boolean b = ps.execute();
ps.close();

In short byte[] work great for me. I really have not tried any other
form. This works for both binary and text data.

--
Sincerely,
William L. Thomson Jr.
Support Group
Obsidian-Studios Inc.
439 Amber Way
Petaluma, Ca. 94952
Phone 707.766.9509
Fax 707.766.8989
http://www.obsidian-studios.com