Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BlackBerry SQLite database creation: "filesystem not ready"

My application takes data from a server and saves it to an SQLite database. This works fine in the 9550 (BlackBerry Storm 2) simulator, but when I run this in any other simulator it gives me this error:

file system not ready

Code snippet:

URI myURI = URI.create("file:///store/MyDataBase.db");   

Why is this happening?

like image 730
nimi Avatar asked Nov 28 '22 15:11

nimi


2 Answers

Richard is right. You need to check for the existence of the filesystem root "store". There is an extra wrinkle for using SQLite, though. RIM only supports SQLite on eMMC storage. So even if "store" exists, it will only work if the underlying storage is eMMC. Notably the BlackBerry Bold 9650 device, AKA Bold2, has "store", but it is not eMMC, so you can't put an SQLite database there.

I'm not aware of any direct way of finding out whether a filesystem is using eMMC. I asked RIM and was told to check the filesystem size. If it's over 1 GB, then it is eMMC. That wasn't a very satisfying answer for me. I ended up checking for the filesystem "system". It is a read-only filesystem, but it is only present for eMMC storage, and if it exists, you can write a database to the "store" filesystem root.

Via the SQLite developer guide overview:

You can use the SQLite API, provided in the net.rim.device.api.database package, to store application data persistently to eMMC memory or a microSD card.

like image 138
Michael Donohue Avatar answered Nov 30 '22 04:11

Michael Donohue


It may be that store is not a mounted and available file system root on the 9550. You should use javax.microedition.io.file.FileSystemRegistry.listRoots() to get an Enumeration of currently mounted file systems.

like image 35
Richard Avatar answered Nov 30 '22 05:11

Richard