I have an application that creates a database file at '/storage/emulated/0/databases/mydb.db' and there are files within this DB. I have another application which tries to open this database. But I get error code 14. Could not open database when trying to oprn the table in this db.
public class DataBaseHelper extends SQLiteOpenHelper {
public SQLiteDatabase myDataBase;
public String TABLE_NAME;
// Database Information
static final String DB_NAME = "mydb.DB";
public static final String FILE_DIR = "databases";
private String DB_PATH = Environment.getExternalStorageDirectory()
+ File.separator + FILE_DIR + File.separator + DB_NAME;
public DataBaseHelper(Context context, String name) {
super(context, name, null, 1);
TABLE_NAME = name;
}
public void openDatabase() throws SQLiteException {
String DBPath = DB_PATH + "/" +TABLE_NAME;
myDataBase = SQLiteDatabase.openDatabase(DBPath,null,SQLiteDatabase.OPEN_READWRITE);
}
@Override
public void onCreate(SQLiteDatabase db) {
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
I get an error at myDataBase = SQLiteDatabase.openDatabase(DBPath,null,SQLiteDatabase.OPEN_READWRITE);