SQLite Forum

readonly access to WAL database
Thanks. I was just using the shell for testing. And I was only using the `SQLITE_FCNTL_PERSIST_WAL` mode in order to make it possible to open the database `-readonly` even when no r/w processes were using it. (Didn't want to rely on the r/o process having write access to the directory containing the database.)

What I've learned from all this is:

* Though it's possible in recent versions of sqlite to open -wal databases r/o, it still is awkward in a couple of ways, and opening rollback-journal databases r/o is easier.

* If you do want to open a -wal database r/o, it can't be in `locking_mode = EXCLUSIVE`. That's ok with rollback-journal databases though.

* If you do open a rollback-journal database in `locking_mode = EXCLUSIVE`, while lacking write permissions to the database file or the directory that contains it, you are able to successfully use the database. From my experiments, it looks like the lock is in those cases simply not acquired.