When two processes access sqlite

Hi!

I sometimes see file corruption on a sqlite database. I think this happens because two processes (2 apps) on the same computer access the file. The corruption happens during a power cut. One process is for syncing operations with a distant server, the other is the application with which the user works.

Is there a way to prevent such file corruptions?

Thanks

http://documentation.xojo.com/index.php/SQLiteDatabase.MultiUser ?

While multiple processes can access a SQLite database it is not an optimal situation…
but nothing is going to prevent “The corruption happens during a power cut”

These links might help:

How To Corrupt An SQLite Database File
https://sqlite.org/howtocorrupt.html

Can multiple applications or multiple instances of the same application access a single database file at the same time?
https://sqlite.org/faq.html#q5

I don’t see how simultaneous access via two different apps will, per se, cause corruption. SQLite prevents simultaneous writes. All simultaneous attempts to write are serialized. However, as far as I know, if you have Journal Mode set to OFF, then a power cut would very easily corrupt the file if in the middle of a transaction, even for single user access.