Disabling sqlite Write-Ahead logging in Android Pie

The best and simplest way to disable WAL mode in your Database is as follows:

public class MyDbHelper extends SQLiteOpenHelper {

    //...

    @Override
    public void onOpen(SQLiteDatabase db) {
        db.disableWriteAheadLogging();  // Here the solution
        super.onOpen(db);
    }

    //...
}

This way, all access to your database will be with WAL mode disabled. As much as you open and close multiple connections throughout the implementation of your App


one cannot use SQLDroidDriver.ADDITONAL_DATABASE_FLAGS, simply because there is no constant available, which would negate flag ENABLE_WRITE_AHEAD_LOGGING.

WAL can still be disabled by creating either of these scenarios:

a) set flag OPEN_READONLY (applies to situations where R/O access does suffice).

b) run PRAGMA journal_mode=DELETE as the first query, in order to override PRAGMA journal_mode=WAL.

c) file an issue against SQLDroidConnection.java, in order to have .enableWriteAheadLogging() and .disableWriteAheadLogging() supported on the driver-level.