aspose file tools*
The moose likes Servlets and the fly likes Binary to string conversion Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Binary to string conversion" Watch "Binary to string conversion" New topic
Author

Binary to string conversion

arul anton
Greenhorn

Joined: Oct 19, 2002
Posts: 1
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

Joined: Apr 11, 2001
Posts: 114
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
 
subject: Binary to string conversion
 
Similar Threads
I cannot obtain the enitre path of image
Image Upload - Jsp or servlet
How can I resize an image from database table and show it
how to upload xls file
How to set date in mysql using prepared statement?