• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to load Image using iBatis?

 
Simpson Kumar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In our application we have to display multiple images on a JSP, and these images are already stored in SQL Server Database.

I can read that Image by JDBC code very simple. Here is the Template



From ResultSet object we can read InputStream object and by using this we can write image on JSP.

My question is there any possibilities to get the InputStream object as Image?
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The javax.imageio.ImageIO.read method can transform an InputStream into a BufferedImage (which is a more useful subclass of Image), provided that the image is a GIF, BMP, JPEG or PNG.
 
Simpson Kumar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Ulf for quick reply..

Can we retrieve that object from through iBATIS?

Say for example, I have an object called ImageVO and it contains InputStream (private InputStream imageStream as instance variable and from iBATIS query

can we retrieve InputStream object?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic