Writing binary - UPDATE - Mailing list pgsql-jdbc

From buki@gmx.net (Andreas Buer)
Subject Writing binary - UPDATE
Date
Msg-id eae9b1b2.0309030504.49c9cabc@posting.google.com
Whole thread Raw
List pgsql-jdbc
Hi,

now I've figured out that it had something to do with the
driver version. But now I get the following message from
ps.toString(), which shows me the right input statement,
but it won't insert anything:

INSERT INTO blob_test VALUES ('noname.bmp', 'BM\\302p\\000\\000\\000\\
.......
\\335\\316\\335\\316\\000\\000')

The table looks like this:
CREATE TABLE blobl_tbl (
  name varchar(35),
  bmp oid
);

Thanks in advance

Andi

openDB();
// All LargeObject API calls must be within a transaction
db.setAutoCommit(false);

File file = new File("c:/test/noname.bmp");
FileInputStream fis = new FileInputStream(file);
PreparedStatement ps =
           db.prepareStatement("INSERT INTO blob_test VALUES (?, ?)");
ps.setString(1, file.getName());
ps.setBinaryStream(2, fis, (int)file.length());
ps.executeUpdate();
FileOutputStream foust = new FileOutputStream("c:/test/b.txt");
OutputStreamWriter osw = new OutputStreamWriter(foust);
osw.write(ps.toString());
ps.close();
fis.close();

pgsql-jdbc by date:

Previous
From: Andreas Bauer
Date:
Subject: Writing binary - UPDATE
Next
From: "Lufkin, Brad"
Date:
Subject: COUNT