Hi All,
I need to save an InputStream read from an Oracle BLOB field into an object with an attribute of InputStream. How can i do this?
<The current code>
......
Blob blob = rs.getBlob("ATTACHMENT");
InputStream is = blob.getBinaryStream();
object.setAttachment(is);
However when i try to use available to check the size, it always returns a 0.
If so, then how may i know the size of the InputStream to loop through it and write the data out?
Basically, I have an web application that allows the user to save some info. including an uploadable binary file (pdf files). Upon saving, the user may come back some other time to view the contents . The ATTACHMENT Field is the BLOB that stores the .pdf file that I need to save. Afterwhich I need to use a
servlet to display the pdf file back to the using response.getOutputStream(). Can someone please help me to solve this problem? or give me some sample code show how it should be done?
Many thanks in advance...
Cheers,
wmeng