Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> JDBC setBinaryStream

JDBC setBinaryStream

From: <ptorrodellas_at_my-dejanews.com>
Date: Fri, 19 Mar 1999 08:38:49 GMT
Message-ID: <7ct2eo$dhi$1@nnrp1.dejanews.com>


I'm using Oracle 7 JDBC Thin driver to manage a documents DB using PreparedStatement and setBinaryStream.

It works well with INSERT statements, but fails in a strange way with UPDATEs. For example, in the following:

 File myFile = new File("C:\\test.sam");  FileInputStream stream = new FileInputStream(myFile);  PreparedStatement pstmt = conn.prepareStatement ("UPDATE DOCS SET    CONTENTS = ? WHERE DOC = ?");
 pstmt.setBinaryStream(1, stream, (int)myFile.length());  pstmt.setString (2, "NO000004");
 int rows = pstmt.executeUpdate();

rows gets 0, no update is done, and there's no Exception or Warning. Strangely enough,

 "INSERT INTO DOCS VALUES (?, ?)" with the same code works well, and so does the same UPDATE code with the file previously read into a byte array and using setBytes instead of setBinaryStream... Could this be a bug, or is setBinaryStream not supposed to work with UPDATEs?

Thanks for any help.

Pere

-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Fri Mar 19 1999 - 02:38:49 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US