I have a sqlite database that does not change .
Several processes that open a database connection in SQLITE_OPEN_READONLY mode using sqlite3_open_v2. Each process is single-threaded.
Connections are made from the MSVC project, using the official C / C ++ Interface, one integrated C source file.
According to the SQLite FAQ, several SELECT processes are excellent
Each process after opening the database creates 4 prepared SELECT statements , each of which has 2 binding values.
During execution, agents (one at a time) have repeated calls as needed
- sqlite3_bind_int
- sqlite3_bind_int
- sqlite3_step (when returning SQLITE_ROW)
- sqlite3_column_int (while there was a row)
- sqlite3_reset
Ready-made applications are reused, so finalization is not called for each of them until the end of the program. Finally, the database is closed at the very end of execution.
Problem Any of these operations may fail with error code = 5: 'database is locked'
Error code 5 is SQLITE_BUSY , and the website states that
"indicates a conflict with a separate database connection, possibly in a separate process"
The rest of the Internet seems to agree that several READONLY connections are OK. I went through the source and donโt see that something is wrong (I canโt post it sadly here, I know, itโs not useful)
So, I appeal to you guys, what can I lose?
EDIT 1 : The database is on the local drive, the file system is NTFS, the OS is Windows 7.
EDIT 2 : Wrapping all sqlite3 calls in infinite loops that check if SQLITE_BUSY was returned and then redo the call fixes the problem. I do not consider this a correction, but if this is true, then I will do it.