开发者

Blackberry SQLite path exception

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);
    }

}


Finally I got the solution

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜