patternsqlMinor
Read-only on an SQLite database which is being modified by another program
Viewed 0 times
readsqliteprogrambeingdatabasemodifiedanotherwhichonly
Problem
I wrote a program that has an SQLite database, modifying it every few seconds.
Now I want to write a small gadget program that would just read a bit of info from that database (read-only) and display it.
Can the second program open the database as "read-only", while the first program might be modifying it?
Is using
Or do I have to make a copy of the SQLite file, or something?
I did not find any tip about this on sqlite.org.
The second program does not need real-time info, it can be a bit outdated.
Now I want to write a small gadget program that would just read a bit of info from that database (read-only) and display it.
Can the second program open the database as "read-only", while the first program might be modifying it?
Is using
Read Only=True when opening the database enough?Or do I have to make a copy of the SQLite file, or something?
I did not find any tip about this on sqlite.org.
The second program does not need real-time info, it can be a bit outdated.
Solution
You are looking for WAL Mode.
WAL provides more concurrency as readers do not block writers and a
writer does not block readers. Reading and writing can proceed
concurrently.
WAL provides more concurrency as readers do not block writers and a
writer does not block readers. Reading and writing can proceed
concurrently.
Context
StackExchange Database Administrators Q#38974, answer score: 5
Revisions (0)
No revisions yet.