アプリで Assets フォルダーのデータベースを使用しようとしていますが、参照できないようです。
次のような構造のセットアップがあります。
public static String DBName = "myDB.db";
public static String DBLocation = "/data/data/com.yes.auntsally/databases/";
public static String DBFullLocation = DBLocation + DBName;
次に、次のように呼び出します。
public static void getDbFile() {
if (dbFile == null) {
dbFile = new File(Global.DBFullLocation);
}
}
public static void openDb() {
if (db == null) {
getDbFile();
db = SQLiteDatabase.openOrCreateDatabase(dbFile, null);
setDbOpen(true);
}
if (!db.isOpen()) {
getDbFile();
db = SQLiteDatabase.openOrCreateDatabase(dbFile, null);
setDbOpen(true);
}
}
しかし、私はエラーが発生しています:
04-02 11:51:31.375: E/SQLiteLog(4024): (14) cannot open file at line 30241 of [00bb9c9ce4]
04-02 11:51:31.375: E/SQLiteLog(4024): (14) os_unix.c:30241: (2) open(/data/data/com.yes.auntsally/databases/myDB.db) -
04-02 11:51:31.390: E/SQLiteDatabase(4024): Failed to open database '/data/data/com.yes.auntsally/databases/myDB.db'.
04-02 11:51:31.390: E/SQLiteDatabase(4024): android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database