This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes JSP and the fly likes Display BLOB contents to the client Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Display BLOB contents to the client" Watch "Display BLOB contents to the client" New topic

Display BLOB contents to the client

Ramesh Bhagasra

Joined: Nov 21, 2003
Posts: 8
I want to display the blob contents in the clients window and give him the option either to open or save the contents. I am able to read the contents from Oracle Blob Field and stored the contents in the ByteArrayOutputStream object but I am not able to open the contents for the client. I am using the following code
Blob blob = resultSet.getBlob(1);
int length = (int)blob.length();
byte [] b = blob.getBytes(1, length );
ByteArrayOutputStream baos = new ByteArrayOutputStream();
response.setHeader("Content-Disposition","attachment; filename="+baos );
Please help me
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
This sort of thing comes up all the time - browse the last few weeks of post or do a search for BLOB.
I agree. Here's the link:
subject: Display BLOB contents to the client
It's not a secret anymore!