Fail to write BLOB - no exception thrown

From: "Craig Jarman" <cjarman(at)source(dot)com(dot)au>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Fail to write BLOB - no exception thrown
Date: 2001-11-11 23:37:17
Message-ID: 009e01c16b09$cd30a700$0a00a8c0@craig
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hi

I am unable to write an image file into postgres using the jdbc7.1-1.2.jar driver.
Application server runs on NT, Postgres 7.1.3 on Linux 7.1.
No exception or error is generated and the transcation appears to go through.
Yet no record is recieved into postgres.

Code:

Class.forName("org.postgresql.Driver");
Connection conn = DriverManager.getConnection("jdbc:postgresql://192.168.0.50:5432/mydb","administrator","password");
File file = new File("d:/Temp/testimage.gif");
FileInputStream fis = new FileInputStream(file);

conn.setAutoCommit(false);
PreparedStatement ps = conn.prepareStatement("INSERT INTO IMAGES VALUES (?, ?)");
ps.setString(1, file.getName());

Long length = new Long(file.length());
ps.setBinaryStream(2, fis,length.intValue());
ps.executeUpdate();
ps.close();
fis.close();

This code works for other dbs.
______________________________

Craig Jarman
Source IT
Ph: 612 9974 1480
Fx: 612 9974 1280
cjarman(at)source(dot)com(dot)au
______________________________

Browse pgsql-jdbc by date

  From Date Subject
Next Message Stuart Robinson 2001-11-12 05:59:42 Re: JDBC inserts on views using rules
Previous Message knut.suebert 2001-11-11 20:59:47 Re: Storing a tree