Try to search your question here, if you can't find : Ask Any Question Now ?

Backup Room database

HomeCategory: stackoverflowBackup Room database
willson asked 2 weeks ago

I’m trying to backup a room database programmatically.

For that, I’m simply copying the .sqlite file that contains the whole database

But, before copying, due to the fact that room has write ahead logging enabled, we must close the database so that -shm file and -wal file merge into a single .sqlite file. As pointed out here

I run .close() on RoomDatabase object:

Everything works fine with the backup, BUT, later on, when I try to execute an INSERT query, I get this error:

android.database.sqlite.SQLiteException: no such table: room_table_modification_log (code 1)

How can I properly re-open room db after I close it?

PS: .isOpen() on RoomDatabase object returns true before INSERT

Room version: 1.1.1-rc1

1 Answers
Best Answer
Matthias answered 2 weeks ago
Your Answer

8 + 10 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com