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
New Developer
Posts: 85
Registered: ‎12-02-2013
My Device: 9360 Curve
My Carrier: BSNL

SQL lite db exception exception "DatabaseIOException : File System not ready"

Hello everyone,

 

I am creating sqllite db in device memory but it throws following exception "DatabaseIOException : File System not ready" in this code: 

 

   URI myURI = URI.create("file:///store/home/user/Databases/SQLite_Guide/" +
           "MyTestDatabase.db");
          d =  DatabaseFactory.create(myURI);

 

i searched forums for this topic but i can't able to find any answer for this , please suggest me how to create sql lite db in device memory?

Developer
Posts: 19,623
Registered: ‎07-14-2008
My Device: Not Specified

Re: SQL lite db exception exception "DatabaseIOException : File System not ready"

Two immediate thoughts:

 

a) If you are doing this as part of a start-up program, then you probably need to wait till the OS is fully up before looking for the files.  See this KB:

http://supportforums.blackberry.com/t5/Java-Development/Write-safe-initialization-code/ta-p/444795

 

2) Are you sure that you have a store 'root'.  See this KB article:

http://supportforums.blackberry.com/t5/Java-Development/Programmatically-determine-if-a-microSD-card...

New Developer
Posts: 85
Registered: ‎12-02-2013
My Device: 9360 Curve
My Carrier: BSNL

Re: SQL lite db exception exception "DatabaseIOException : File System not ready"

Hi peter thanks for your suggestion ,

 

1. I create my database on button click

2. Yes i am sure i have a store root .

Developer
Posts: 19,623
Registered: ‎07-14-2008
My Device: Not Specified

Re: SQL lite db exception exception "DatabaseIOException : File System not ready"

[ Edited ]

What device and OS l;evel are you testing on?  Can you replicate this problem on a SImulator?

 

Also there are a number of similar Threads on this forum - have you reviewed them?

New Developer
Posts: 85
Registered: ‎12-02-2013
My Device: 9360 Curve
My Carrier: BSNL

Re: SQL lite db exception exception "DatabaseIOException : File System not ready"

My device is curve 9360 and bbos version is 7.1 , in simulator my code works fine.

Developer
Posts: 19,623
Registered: ‎07-14-2008
My Device: Not Specified

Re: SQL lite db exception exception "DatabaseIOException : File System not ready"

Silly question I know, but you have confirmed, before you run this code, whether the database exists or not? 

New Developer
Posts: 85
Registered: ‎12-02-2013
My Device: 9360 Curve
My Carrier: BSNL

Re: SQL lite db exception exception "DatabaseIOException : File System not ready"

No database doesn't exists before runing this code

Developer
Posts: 19,623
Registered: ‎07-14-2008
My Device: Not Specified

Re: SQL lite db exception exception "DatabaseIOException : File System not ready"

Can you replace this:

 

d =  DatabaseFactory.create(myURI);

 

with

 

try {

d =  DatabaseFactory.create(myURI);

} catch (Throwable t) {

System.out.println("Error creating database: " + t.toString());

t.printStackTrace();

String root = null;
Enumeration e = FileSystemRegistry.listRoots();
while (e.hasMoreElements()) {
     root = (String) e.nextElement();
     System.out.println("Root: " +(String) e.nextElement());
}

throw t;

}

 

Let us know whjat you see in the Event Log.