vks
vks

Reputation: 7071

SQLite Database creation error in blackberry

I am trying to create an SQLite DB using BlackBerry IDE. First I mount sdcard to a folder in my PC using simulator.

URI myURI = URI.create("file:///SDCard/Databases/" + "Test.db");
d = DatabaseFactory.create(myURI);
d.close();

After I run the code I get the exception

Path does not contains a proper root list. See FileSystemRegistry class for details

Anybody know what is the issue?

Upvotes: 1

Views: 365

Answers (2)

Arun Kumar Munusamy
Arun Kumar Munusamy

Reputation: 871

Can you try the below code without any changes please

Database d;
public CreateDatabaseScreen()
{

   try
   {
       URI myURI = URI.create("file:///SDCard/Databases/my_database/" +"Test.db"); 
       d = DatabaseFactory.create(myURI);
       d.close();
       add(new RichTextField("DB created successfully"));
   }
   catch ( Exception e ) 
   {         
       System.out.println( e.getMessage() );
       e.printStackTrace();
       add(new RichTextField("Error: "+e.toString()));
   }
}

Upvotes: 1

Vit Khudenko
Vit Khudenko

Reputation: 28418

I suspect a USB cable is inserted while you are testing the app. If this is the case just disconnect and try again. On BB if USB cable is attached then SDCard becomes unavailable.

Upvotes: 0

Related Questions