运行我的应用程序时出现以下错误:
'/data/data/in.acme.www.solarproject/databases/SolarDatabase.sqlite'.
android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database
at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:209)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:193)
at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177)
at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:807)
at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:792)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:697)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:672)
at in.acme.www.solarproject.database.DBHelper.checkDataBase(DBHelper.java:81)
at in.acme.www.solarproject.database.DBHelper.createDataBase(DBHelper.java:49)
try{
String myPath = DATABASE_PATH + DATABASE_NAME;
checkDB = SQLiteDatabase.openDatabase(myPath, null,
SQLiteDatabase.OPEN_READWRITE); // (DBHelper.java:81)
}catch(SQLiteException e){
//TODO: Add exception
e.printStackTrace();
}
我已将我的数据库复制到资产文件夹,来自他们对getDbrecords()的查询
SQLiteDatabase mReadableDB= mDbHelper.getReadableDatabase();
try{
mCursor=mReadableDB.rawQuery("SELECT * FROM DepartmentMaster ",null);
从那里出现异常。请帮忙解决。
答案 0 :(得分:0)
你可以尝试几件事:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />