Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Concurrent access in SQLite

Can SQLite manage concurrent access? I use SQLite with C/C++? If it doesn't support that. Is there any suggestion to support concurrent access in SQLite?

like image 429
Aan Avatar asked Nov 14 '12 05:11

Aan


1 Answers

Yes it does as the documentation states here:

SQLite Version 3.0.0 introduced a new locking and journaling mechanism designed to improve concurrency over SQLite version 2 and to reduce the writer starvation problem. The new mechanism also allows atomic commits of transactions involving multiple database files.

and:

SQLite uses POSIX advisory locks to implement locking on Unix. On Windows it uses the LockFile(), LockFileEx(), and UnlockFile() system calls.

And here:

SQLite uses filesystem locks to make sure that only one process and database connection is trying to modify the database at a time. The filesystem locking mechanism is implemented in the VFS layer and is different for every operating system. SQLite depends on this implementation being correct. If something goes wrong and two or more processes are able to write the same database file at the same time, severe damage can result.

like image 89
CloudyMarble Avatar answered Sep 25 '22 19:09

CloudyMarble