Writing binary - UPDATE

From: buki(at)gmx(dot)net (Andreas Buer)
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Writing binary - UPDATE
Date: 2003-09-03 13:04:36
Message-ID: eae9b1b2.0309030504.49c9cabc@posting.google.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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();

Browse pgsql-jdbc by date

  From Date Subject
Next Message Lufkin, Brad 2003-09-03 14:25:11 COUNT
Previous Message Andreas Bauer 2003-09-03 13:00:35 Writing binary - UPDATE