when i try to insert a serialised image/xml-file into an oracle database, the value that is inserted is always "null". it would be very nice, if somebody could help me with that.
//lock new row pstmt = con.prepareStatement("select sectiontemplate from sectionlist where sectiontemplateid = " + stidcounter + " for update"); pstmt.executeUpdate();
File file = new File(tdir + tfilename); FileInputStream fis = new FileInputStream(file); pstmt = con.prepareStatement("update sectionlist set sectiontemplate=? where sectiontemplateid=" + stidcounter); //PreparedStatement pstmt = con.prepareStatement("insert into image (image) values (?)"); pstmt.setBinaryStream(1, fis, (int)file.length()); //pstmt.setString(2, dir + filename); pstmt.executeUpdate(); pstmt.close();
Try to use the OCI-driver instead of the pure-Java driver. This should solve the problem ! Note that this worked on Win-NT client machine running NT4. I believe you are using Oracle 8i with Java 2 ? Is your column the last one ?
Well Oracle love the varchar / varchar2 as last one :-) May be modifying that (making it last) should help unless you could insert DATA's like that earlier on with "normal" language (C, C++, python, ...) ?