I'm implementing Foreign Keys in my SQLite DB in Android.
I had my DB working well without FK, but now, I have several problems.
One is when I try to get reference to db, I have this error.
E/SQLiteLog﹕ (10) Failed to do file read, got: 0, amt: 100, last Errno: 2
My Function:
public synchronized SQLiteDatabase openDatabase() {
if (mOpenCounter.incrementAndGet() == 1) {
// Opening new database
mDatabase = mDatabaseHelper.getWritableDatabase();
// Get Foreign Key Support
mDatabase.execSQL("PRAGMA foreign_keys=ON");
}
return mDatabase;
}
The error happens in the line:
mDatabase = mDatabaseHelper.getWritableDatabase();
It seems to be the first time that this line is called. Other time, there is no pb. I'm not sure it gives me direct errors, but I have several problems in SQLite, so it might contribute to bad behaviour.
Tx
Try this:
uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With