• 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

Save and retrieve image in derby database

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to save an image in derby database and retrieve it. Please help me out in this. Its very urgent
 
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please EaseUp. There's no such thing as urgent around here.

Did you declare the column as a BLOB, or the Derby equivalent? You can then use PreparedStatement and its setBytes, setBlob or setBinaryStream methods. Retrieving is done using ResultSet's getBytes, getBlob or getBinaryStream methods.

I'll move this thread to our JDBC forum. And welcome to the Ranch!
 
Madhuri Abhi
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have saved the image in database but not able to retrieve it by converting it from hex(thats how its stored in database) to image.
 
Rob Spoor
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So all you need to do is convert the hex into a byte[], then convert the byte[] into an image. For the first you should use our search; I can clearly remember a discussion about it in Java in General. For the second you can use ImageIO.
 
reply
    Bookmark Topic Watch Topic
  • New Topic