• 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

Creating ImageIcon with byte[] from RS.getBytes

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to create an ImageIcon
using a byte[] that I got
from the result set using getBytes.
The DB I am using is Access 2000
and I store my image as OLE Object data type.
I use
byte[] tmpValue = rs.getBytes(columnInt);
ImageIcon tmpImage = new ImageIcon(tmpValue);
..then When i print the imageIcon height
I get -1 and when I print the
imageIcon.getImageLoadStatus();
it returns "4" -- equivalent to an error loading
Any suggestions???
Joanna
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are trying to write both bits at he same time (ie read from db and convert into ImageIcon), do them one at a time first.
Probably read the byte stream and dump it to either standard out or a file. If you dump it to a file you should be able to load it in a viewer.
After you know this is working, debug the ImageIcon bit. I've had problems with ImageIcon before when trying to do two things at one with it.
 
reply
    Bookmark Topic Watch Topic
  • New Topic