Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

problem with the image field

 
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
 
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.
 
There’s no place like 127.0.0.1. But I'll always remember this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic