How To Export a SQLite Blob Field Containing a JPG File as Part of a Text File

Mahares

Expert
Licensed User
Longtime User
I have a SQLite table that contains 4 fields (INTEGER, TEXT, TEXT, BLOB), the last one being a BLOB. I exported the content of the table to a tab delimited text file with theBLOB field included. Below is one of the records when the file is opened using Notepad. I used StringUtils and EncodeBase64 to create the file. The BLOB field data shown in blue is all scrambled as shown below where I show a segment of the text as it goes down for several lines. How do I display the image on a PC? Do I need a special viewer?
2 G2 Battery Compartment
/9j/4AAQSkZJRgABAQEASABIAAD//gAvUHJvY2Vzc2VkIEJ5IGVCYXkgd2l0aCBJbWFnZU1hZ2ljaywgUjEuMC4xLk0x/9sAQwAKBw
Thank you very much
 

Mahares

Expert
Licensed User
Longtime User
Thank you Erel. I downloaded one base64 decoder/Encoder that uses the command prompt by Fatih Kodak. It did not do anything. The black command screen flashes for a second and no files are converted. I tried another one and it was intercepted by my virus scan.
It appears that The way I am doing it is very ineffective. There has to be a better way handling images than through SQLite blob fields:
Is there a better way than just saving a jpg file as a BLOB in a SQLite table and using Base64de/encoder?
I am thinking a better way may be:
1. Use the device camera to take pictures, save them with specific names and copy them to the server. At the server I can manipulate them in their proper format, instead of using a SQLITE blob, converting to a text file and decoding, which I did not even succeed to do.
Thanks
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
1. The pictures are already stored in jpg format in the device. I include them as a BLOB in a SQLite table.
2. Then, I export the SQLite table for a given date range to a tab delimited text file including the BLOB, that will eventually end up in the server.
3. Finally, I want to import the text file including the blob into an Access or MS SQL server database, with the pictures in their native format jpg.
What is the best way of doing this?
Thank you
 
Upvote 0
Top