Win a copy of Murach's Python Programming this week in the Jython/Python forum!
    Bookmark Topic Watch Topic
  • New Topic

Reading from BLOB into InputStrea Problem  RSS feed

Wai Meng Ng
Posts: 22
  • Mark post as helpful
  • send pies
  • Report post to moderator
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();
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...
Jim Yingst
Posts: 18671
  • Mark post as helpful
  • send pies
  • Report post to moderator
Answered here. Please don't post duplicates in different forums. Thanks.
[ November 04, 2003: Message edited by: Jim Yingst ]
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!