• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Displaying Image from database on to the screen

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear,
Can any one solve my problem regarding displaying image on the screen.
I have stored my image in SQL database as data type called "image" format.
I am trying to get the binary data and display on the screen using jsp. It gives me the error
"java.lang.IllegalStateException"
Here is the code that i am using
CallableStatement stmtInsert= con.prepareCall( " { call spSM_Image }");
ResultSet rs = stmtInsert.executeQuery();

response.setContentType("image/jpeg");

if (rs.next())
{
byte [] buf = rs.getBytes("photo");
ServletOutputStream op = response.getOutputStream();

for(int i=0;i<Integer.parseInt(dim_image);i++)
{
op.write(buf[i]);
}
Pls. reply if some one can help this out

ashok pandey
 
reply
    Bookmark Topic Watch Topic
  • New Topic