Re: Show Bolb image data by Servlet
Mohammed Moizuddin <[email protected]>
| Newsgroups | gmane.comp.java.sun.servlet |
|---|---|
| Organization | Center for Communication & Computer Research |
| Message-ID | <002501c32353$a9a55bb0$04020f0a@pcmoiz> |
I do the following way:
First set the content type of the servlet as:
private static final String CONTENT_TYPE = "image/jpeg";
response.setContentType(CONTENT_TYPE);
Then the following:
while(rs.next()){
BLOB l_mapBLOB = ((OracleResultSet)rs).getBLOB(1);
InputStream in = l_mapBLOB.getBinaryStream();
//InputStream in = rs.getBinaryStream(1);
ByteArrayOutputStream boas = new ByteArrayOutputStream();
byte b[] = new byte[1024];
while(true) {
int bytes = in.read(b);
if(bytes==-1) {
break;
}
boas.write(b, 0, bytes);
}
b = boas.toByteArray();
response.setContentLength(b.length);
out.write(b,0,b.length);
}
Hope this will help you.
Regards,
Moiz
-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[email protected]] On Behalf Of
vikramjit singh
Sent: Monday, May 26, 2003 9:05 AM
To: [email protected]
Subject: Re: Show Bolb image data by Servlet
The image when you retrieve, store it in a physical location on the
server .jpg or whichever image format. And call it how you use in html
page.
-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[email protected]]On Behalf Of
Souvik Basak
Sent: Monday, May 26, 2003 10:10 AM
To: [email protected]
Subject: Show Bolb image data by Servlet
Hi,
How can I show A BLOB Image data, retrieved from Oracle Database
(using ResultSet.getBlob()), on the Web page with the help of
servlet/JSP. regards, Souvik Basak
________________________________________________________________________
___
To unsubscribe, send email to [email protected] and include in the
body of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
________________________________________________________________________
___
To unsubscribe, send email to [email protected] and include in the
body of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html