Skip to content Skip to sidebar Skip to footer

Is It Possible To Disable Wal On Android Sqlite Database?

I do have a lot of problems with database backup/restore on these few Android devices that do have WAL (write ahead logging) enabled. Is it possible to switch that off after such a

Solution 1:

You can change database mode to TRUNCATE mote by this line of code:

setJournalMode(RoomDatabase.JournalMode.TRUNCATE)

Solution 2:

Executing PRAGMA journal_mode=DELETE on the database should remove Wal mode and return to the normal method of operation.

Full documentation here: http://www.sqlite.org/wal.html

Solution 3:

Programmatically we can enable and disable the WAL mode. It has been there since API level 11

Refer this doc for more info

http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#enableWriteAheadLogging()

Post a Comment for "Is It Possible To Disable Wal On Android Sqlite Database?"