Writing data to Oracle using setAsciiStream
Hello,
I'm trying to copy data from one Oracle table to another. Everything works except for the field with data type Long. I tried doing a Preparestatement, and writing it with an InputStream with the following code. The idea is that we know the length of the date is 4463 bytes, and we can write that to the database with the setAsciiStream function. Supposedly, the function writes the whole stream in automatically. The problem I'm having is that no data is written into the Long field (the field is named "DATA"). No exceptions are thrown, but no data is written either. I know that the data is being passed to the streamCopy variable, because I've looped through it byte by byte and printed it out, and it's all there (and, it's 4463 bytes in length).
Any ideas?
Thanks!
David
Here's the code:
java.io.InputStream streamCopy = objRecCopy.getAsciiStream("DATA");
// Copy the current preparation data. We have to use a Prepared Statement so that it will
//automatically deal with special characters.
strSQL = "insert into PREPARATION_DATA (INSTANCE_ID, PREP_ID, DATA, EXT) values ("
nInstVal + ", " + objRecCopy.getString("PREP_ID") + ", ?, '" + objRecCopy.getString("EXT") +"')";
stmtPrepared = objCon.prepareStatement(strSQL);
stmtPrepared.setAsciiStream(1, streamCopy, 4463);
stmtPrepared.execute();

