Problem with Image Storing on Blackberry Databases

869 views Asked by At

I am using SQLite database in my BlackBerry mobile application and it works fine.

I want to save a camera capture image to the database. The size of the camera capture image is 400k, but I reduce it to 7000 bytes.

When I am trying to insert it into the database, it shows Blob size is too Big. The database accepts only up to 4000 bytes per query.

How can I insert this image? Could anyone guide me please?

1

There are 1 answers

0
Donal Fellows On

While in general SQLite has pretty reasonable limits on BLOBs, things are much more constrained on a Blackberry. (The limit is really set at the time of compilation of the DB engine.) You can use the information on the first page to actually find out what the limit really is (though be aware that this may vary between Blackberry platforms; this is noted on the second page):

int sizeLimit = sqlite3_limit(db, SQLITE_LIMIT_LENGTH, -1);

However, the second link does note that it is good practice to store as little data in the DB as possible (well, be reasonable; if data needs to be in, it should be in) with the rest of the information stored as normal files. In the case of images, I'd suggest putting the image itself in a file and keeping only metadata (including the filename, naturally!) in the database. That'll work around the size limits while still allowing reasonably rich queries. What you lose by doing this is transactional storage of the image data (but if what you are gaining in return is the ability to store the data at all, that's still a good trade).