This is the code to retrieve
while (rs.next() ) {
Blob fileBlobContent = rs.getBlob(1);
String fileName = rs.getString(2);
String value = rs.getString(3);
long fileNum = new Long(value).longValue();
java.io.InputStream is =
((oracle.sql.BLOB) fileBlobContent).getBinaryStream();
FileOutputStream fos =
new FileOutputStream("c:\\temp\\"+fileName);
int c = -1;
while ((c = is.read()) != -1) {
fos.write(c);
}
This is the code to insert into the row aftre inserting empty blob
// step 3 - now put the contents of the file
int length = 0;
int buff_size = 1024;
//Writer out_clob = ((oracle.sql.CLOB)fileCobContent).getCharacterOutputStream();
OutputStream outstream = ((oracle.sql.BLOB) fileBlobContent).getBinaryOutputStream();
long chars_read = data.length();
byte[] buffer = new byte[buff_size];
while ((length+buff_size) < chars_read) {
outstream.write(buffer, length, buff_size);
length += buff_size;
//outstream.flush();
}
// write remaining data
int remaining = (int)(chars_read-length);
outstream.write(buffer, length, remaining);
// steps 4-5:
outstream.flush();
Any help is greatly appreciated. Thanks!