I have mapped a Blob to a byte[] array and trying to save into Oracle database.
My code:
Email email = new Email();
File attachment = new File("C:/temp/full_cream.gif");
if (!attachment.exists()) {
assertTrue(true);
return;
}
email.setEmailattachmentfilename(attachment.getNam e());
InputStream is = new FileInputStream(attachment);
byte[] data = new byte[is.available()];
is.read(data);
is.close();
email.setEmailattachment(data);
Error:
As the file is very huge and trying to read all at one time into the byte[] array am getting an out of memory exception.
Any help on this is highly appreciated.
Thanks.


Reply With Quote