Thank you!
views:
677answers:
3
+1
A:
Not necessarily. If sqlite3 is compiled with the thread safe macro (check via the
int sqlite3_threadsafe(void)function), then you can try to access the same DB from multiple threads without the risk of corruption. Depending on the lock(s) required, however, you may or may not be able to actually modify data (I don't believe sqlite3 supports row locking, which means that to write, you'll need to get a table lock). However, you can try; if one threads blocks, then it will automatically write as soon as the other thread finishes with the DB.
Mikeage
2008-12-10 07:23:56
+2
A:
No - SQLite does not support concurrent write access to the same database file. SQLite will simply block one of the transactions until the other one has finished.
Good Luck
Liron Levi
Creator of the SQLite Compare diff/merge utility
+1
A:
note that if you're using python, to access a sqlite3 connection from different threads you need to disable the check_same_thread
argument, e.g:
sqlite.connect(":memory:", check_same_thread = False)
as of the 24th of may 2010, the docs omit this option. the omission is listed as a bug here
Jeremiah Rose
2010-05-24 05:11:06