Create SQLite database on BlackBerry
Invalid path name. Path does not contains a proper root list. See FileSystemRegistry class for details.
I want to create a DB in appication folder.I created a folder in res folder. I tried to access this folder(db) as:
URI dbURI = URI.create("file:///res/db/MyDB.db");
Database database = DatabaseFactory.create(dbURI);
URI dbURI = URI.create("file:///db/MyDB.db");
Database database = DatabaseFactory.create(dbURI);
URI dbURI = 开发者_StackOverflow社区URI.create("/res/db/MyDB.db");
Database database = DatabaseFactory.create(dbURI);
URI dbURI = URI.create("/db/MyDB.db");
Database database = DatabaseFactory.create(dbURI);
I also tried to create SDCard directory on simulator and give this path. None of them worked for me. Please help me.
Your res/ directory is for things you want to add to the project, but as far as I'm aware you can't create files inside of it after you've deployed. Regardless, what you should probably do is either create it in a folder on the user's device (probably file:///store/), or on the SD card (file:///SDCard/).
精彩评论