SQL UPDATE does not work

Hey Guys,

I have an update sql query which does not work with PreparedStatement object. Heres the code snippet:

PreparedStatement pstmt;

int numUpd;

pstmt = con.prepareStatement(

"UPDATE item_articles SET dataFile=? WHERE itemID=?");

con.setAutoCommit(false);

pstmt.setBinaryStream(1,fis,(int)file.length());

pstmt.setInt(2,item.id);

numUpd = pstmt.executeUpdate();

con.commit();

What I am doing here is that setBinaryStream(...) will upload a file into the DB. The query executes, theres no exception thrown, but my table shows empty field for the file. Note, there are no exceptions thrown from this query.

If I do the same thing for an INSERT statement, it works. The file gets into the DB. So , the file is there on disk, and theres no problem with it. Just that it does not work with UPDATE.....any clues ?

thanks

Askar

[917 byte] By [azaidi1a] at [2007-11-27 8:47:18]
# 1
If your itemID value isn't in use, the UPDATE is a noop. Hmmm... what is the value returned to numUpd?
BigDaddyLoveHandlesa at 2007-7-12 20:51:54 > top of Java-index,Java Essentials,Java Programming...
# 2
I think UPDATE commands dont work well with blobs.I use to select the register with a ResultSet, then get a BLOB Object from the column.So you can use a OutputStream to Upload your data.
pbulgarellia at 2007-7-12 20:51:54 > top of Java-index,Java Essentials,Java Programming...