File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Binary to string conversion

 
arul anton
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
prabhat kumar
Ranch Hand
Posts: 114
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic