aspose file tools*
The moose likes Servlets and the fly likes Problem showing an image from database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Problem showing an image from database" Watch "Problem showing an image from database" New topic
Author

Problem showing an image from database

Evaristo Ballorca
Greenhorn

Joined: Feb 13, 2002
Posts: 17
Hello everybody, i've a problem and i don't know where is it. I want send ti the client a image loaded from a database( SAP DB ). In the database the image is save like a LONG BYTE column. When a receive a request for a image i make a select to the database and i load the byte array in a bean. Then a send the byte to the cliente in ths way:


byte[] abData = bean.getData();
resp.setContentType( "image/jpeg" );
resp.setContentLength(abData.length);
resp.getOutputStream().write( abData );
resp.getOutputStream().close();


It doesn't work If i do this with a image in the server file system it work. I don't know where is the problem.

Thanks.
[ June 27, 2004: Message edited by: Michael Ernest ]
Evaristo Ballorca
Greenhorn

Joined: Feb 13, 2002
Posts: 17
It's work fine. The problem was in the way that a read the file from the request and i save it in the database.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem showing an image from database