Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

E/SQLiteLog﹕ (10) Failed to do file read, got: 0, amt: 100, last Errno: 2

Tags:

android

sqlite

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

like image 971
Juliatzin Avatar asked Nov 10 '22 17:11

Juliatzin


1 Answers

Try this:

uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
like image 195
Rathod Bhavesh Avatar answered Nov 15 '22 07:11

Rathod Bhavesh