0

I developing an app which uses sqllite to store some data,I use the code from http://docs.blackberry.com to create database,create tables etc.Its works fine in my simulator But not in my blackberry bold9000. I got the exception "net.rim.device.api.database.DatabasePathException: Invalid path name. Path does not contains a proper root list. See FileSystemRegistry class for details."

So I try to store db in memory using URI uri = URI.create("/store/home/user/myDb.db"); It also fails,I stucked here,The experts please help me. Is it the problem of my Code or my phone? Also please send useful links and share your ideas with me.Thanks a lot in advance. I used the following code...

public void creatDatabase(){
    try {
        URI uri = URI.create("/SDCard/Databases/myDb.db");
        Statement statement =null;
        Database grabDB = null;
        if(!DatabaseFactory.exists(uri)){
            grabDB = DatabaseFactory.create("file:///SDCard/Databases/myDb.db");
            statement = grabDB.createStatement("create table  tblFavStationList(url Text PRIMARY KEY, StationName Text,StationImage Text,Bitrate Text ,Formats Text)");
            statement.prepare();
            statement.execute();
            statement.close();
            System.out.println("tab1 created...");
            statement = grabDB.createStatement("create table  tblTagStationList(Tagurl VARCHAR(256) PRIMARY KEY, TagSongDesc VARCHAR(256))");
            statement.prepare();
            statement.execute();
            statement.close();
        grabDB.close();
        System.out.println("db cre");

        }
    } catch (Exception e) {
    System.out.println(e);
    }

}
demongolem
  • 9,474
  • 36
  • 90
  • 105
Jisson
  • 3,566
  • 8
  • 38
  • 71
  • 2
    Have you checked the path on the phone to verify that each aspect exists? That is, does SD Card have a directory called 'Databases' ? It's been a while since I set up a db, but I remember dealing with similar issues – taylonr Mar 24 '11 at 13:32
  • 1
    Thanks Tayonr,Your comment helped me to resolve the exception,Thaks a lot – Jisson Mar 24 '11 at 14:12

1 Answers1

2

Finally I got the solution

when I use grabDB = DatabaseFactory.openOrCreate(""), the problem resolved,Thanks every body helped me.

Jisson
  • 3,566
  • 8
  • 38
  • 71