Following error is comming while running my application :
'/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();
}
i had copied my db to assets folder, from their i query for the getDbrecords()
SQLiteDatabase mReadableDB= mDbHelper.getReadableDatabase();
try{
mCursor=mReadableDB.rawQuery("SELECT * FROM DepartmentMaster ",null);
from there exception is comming .Please help to resolve it .
Few things you could try:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />