Android android.database.sqlite.SQLiteException: unable to open database file
Actually what you are using is Transaction
.and when transaction is in progress no other process can access the database.
I think that is why you are getting this exception
Sometimes it happens
- when
beginTransaction
is called on a not-open database connection. - when SQL statements contain syntax errors
- You have to
close
the connection with the database of process A first before you start using database with process B. - This will solve your
concurrency
. - we Use
db.close();
I hope this might be your problem.
if process A tries to access the sqlite database, everything is fine. However, if process B does so, following exception will be shown
Sqlite will only open databases from your applications database directory.
DB_PATH = "/data/data/"+ context.getPackageName() + "/databases/";
In your case Database is present in Process A directory so it can access it.But Process B can not read database from Process A directory.
What you can do is copy that database file in Process B directory by giving above path.