Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

problem with the image field

 
Srinath R
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have a data base in sql in which i hava a field which is of type image useing jdbc i am getting the values of the table into the result set. now my problem is that i am unable to retieve this filed, i need to retrive this and save it on to the disk as a file. my result set is 'rs1' now if i give
InputStream fileInput = rs1.getBinaryStream(2);
(where the second fileld in the result set is an image) it gives an "invaliod Discriptor Index" error.
i think the getBinaryStream method is not suited for images but i am un able to know the method that can b used to retrieve the image
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try using
byte[] b = (byte[])rs1.getObject(2);
ImageIcon image = new ImageIcon(b);
Hope this helps
 
Srinath R
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanx Carl Trusiak,
but my problem is that is need to save this image onto my harddisk and later retrieve it, i would like to know how would i go about this kindly give me some sugessiotn about this.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!