• 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

Binary to string conversion

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i tried to insert the image into mysql and retrive it into the borwser in java servlet using resin web server. i can successfully insert the image into the datbase. but i faced some difficulties when i tried to retrive the image from mysql database to the browser. i used the blob datatype for storing images. i can able to retrieve the binary value of the image.
my difficuties:-------------
1. how can we convert the binary value of one image into string value and store it into database?
2. i have two fields in my database
1. text
2. image
if give the text as an input thru browser, it should be comapred with the text which is already stored in the database. if the comparision is succeed then it refer the binary value of the corespondent image to the input text. and store this in mirror table and once again compare with the image from the orginal datbase. if they matched then retrive the coresspondent text to foreground.

pls help me.
 
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if you want to convert the binary value of image/any binary file
then you can use Base64 encoding to convert to ASCII string and when required you can decode
it and write directly to servlet stream.
Base64 encoder and decoder can be found in sun.misc.util package if i remember correctly.
 
Do you pee on your compost? Does this tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic