Fail to write BLOB - no exception thrown - Mailing list pgsql-jdbc

From Craig Jarman
Subject Fail to write BLOB - no exception thrown
Date
Msg-id 009e01c16b09$cd30a700$0a00a8c0@craig
Whole thread Raw
List 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@source.com.au
______________________________

pgsql-jdbc by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: SQLException: ERROR: oidin: when loading GIF file
Next
From: Stuart Robinson
Date:
Subject: Re: JDBC inserts on views using rules