Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Contributor
Posts: 13
Registered: ‎10-01-2010
My Device: Storm 9500
Accepted Solution

Blackberry Bold 9700 and SQLite, DatabaseIOException

[ Edited ]

I`ve developed an Application for the Blackberry Storm with Api 5. It do some inserts in an SQLite Database and read them to show in a picturescrollField. No Problem at all.

 

Code is simple like this:

 

 

 myURI = URI.create(dir+database_file_name);
 db = DatabaseFactory.open(myURI);
 Statement read = db.createStatement("SELECT * FROM " + Tabellenname + " where Object_Id =" + object_id);
 read.prepare();
 c = read.getCursor();
 while (c.next())
 {
 countme++;
 }
 read.execute();
 read.close();

 

But if i wanna use the App on the Blackberry Bold 9700 iam getting the following error massage:

 

net.rim.device.api.database.DatabaseIOException: File system not ready

 

What does it excactly mean and how can solve it ? 

Developer
Posts: 466
Registered: ‎03-04-2009
My Device: 8520
My Carrier: some

Re: Blackberry Bold 9700 and SQLite, DatabaseIOException

all right, a common issue.
1. do you store your db file on sd card?
2. make sure your app is not 'auto-run on startup', If it is then you need to do some modifications
3. make sure your device is not plugged-in via USB
Got resolved! Press kudo icon!
Contributor
Posts: 13
Registered: ‎10-01-2010
My Device: Storm 9500

Re: Blackberry Bold 9700 and SQLite, DatabaseIOException

Ok, then i would say point 3 is the issue i will try it tomorrow without plugged usb.

New Developer
Posts: 134
Registered: ‎01-11-2011
My Device: curve

Re: Blackberry Bold 9700 and SQLite, DatabaseIOException

you should use OpenOrCreate(uri)

New Developer
Posts: 134
Registered: ‎01-11-2011
My Device: curve

Re: Blackberry Bold 9700 and SQLite, DatabaseIOException

when you use c.getCursor then don't use st.execute();it didnot creates a problem but programmtically its not good.

Contributor
Posts: 13
Registered: ‎10-01-2010
My Device: Storm 9500

Re: Blackberry Bold 9700 and SQLite, DatabaseIOException

[ Edited ]

First of all: Thx for the hints. Would be nice if u explain ure hints.

 

Second: the real Problem

 

I tired it without an usb connection and it still dont work on Bold.

The database is created but it seems like i get no answer for my select request.

If i plug in usb there is the massage that the Filesystem is not ready. 

 

So how i can see whats the error on the device without usb plugged in or what are other possible options for this failure ? Remember on the Blackberry Strom all works fine.

 

 

Developer
Posts: 467
Registered: ‎07-16-2009
My Device: Z10 LE
My Carrier: Vodafone NL

Re: Blackberry Bold 9700 and SQLite, DatabaseIOException

[ Edited ]

I assume that DB was create before. Can you confirm?

I assume that db isn't opened somewhere else in the code. Can you confirm?

I assume the statements for the table creation and insertion the values were succeeded before. Can you confirm?

 

Contributor
Posts: 13
Registered: ‎10-01-2010
My Device: Storm 9500

Re: Blackberry Bold 9700 and SQLite, DatabaseIOException

1. Yes, i create the Database in the main function like this: 
public void createdb()
{
// Erzeugen der Datenbank und einer Tabelle falls noch nicht vorhanden
try
{
    FileConnection database_file =(FileConnection)Connector.open(dir+database_file_name);
    System.out.println("Existiert Datenbank ? " + database_file.exists());
    if (!database_file.exists())
    {
    	System.out.println("Datenbank erstellt !");
    	database_file.create();
    	myURI = URI.create(dir+database_file_name);
		db = DatabaseFactory.open(myURI);
		user = db.createStatement("CREATE TABLE " + "'" + Tabellenname + "'" +"( "
					+ "'Object_Id' Integer," + "'Name' Text," + "'URL' Text," + "'Media' Text)");
		System.out.println("CREATE TABLE " + Tabellenname +"( "
					+ "'Object_Id' Text," + "'Name' Text," + "'URL' Text," + "'Media' Text)");
		user.prepare();
		user.execute();
		user.close();
		db.close();
       }
       else
       {
          System.out.println("Datenbank nicht erstellt");
       }
       database_file.close();
   }
   catch(Exception e)
   {
	System.out.println("Catch Fall - Datenbank Erstellung - " + e);
   }
}

2. Yes, but is there a way to proof it ?

 

3. Yes.

If i take the databse creation out of my code, becuz database is there. This still changes nothing.
Highlighted
Developer
Posts: 638
Registered: ‎07-02-2009
My Device: Not Specified

Re: Blackberry Bold 9700 and SQLite, DatabaseIOException

HI fastidias,

 

I think that you are trying to create or open a .db (sqlite) file from the device memory.

 

There is a issues with 5.0 OS Bold (9700) that it won't allow to access the .db file from the device memory.

 

If you try to execute the same on Strom (simulator even) it will work.

 

Resolution: make sure to create/access your .db file on SDCard only. espicially for Bold devices.

 

Plz let us know the results by changing the path to SDCard and also on Strom.

Thanks and Regards,
PraveenGoparaju.
Contributor
Posts: 13
Registered: ‎10-01-2010
My Device: Storm 9500

Re: Blackberry Bold 9700 and SQLite, DatabaseIOException

Iam Saving all the data now on SDCard and it works fine on both devices !