On Fri, Jun 14, 2013 at 9:10 AM, Vijay Khurdiya <
[email protected]> wrote:

> Please confirm below statement is TRUE when Sqlit3 configure in thread
> safe mode. (I am checking for Serialized)
>
> "Multiple processes can access same database connection"?
>

False.

A "database connection" is an in-memory object that communicates with an
SQLite database file.  The operating system prevents multiple processes
from accessing the same memory, so it is not possible for multiple
processes to access the same database connection.

Perhaps you meant to ask if multiple processes could access the same SQLite
database file at the same time.  The answer to that question is "yes".

An SQLite "database connection" is analogous to the FILE* handle of
fopen().  You can fopen() the same file at the same time from multiple
processes.  Each process has its own private FILE* handle, but all FILE*
handles point to the same file on disk.  In the same say, each process
using sqlite3_open() will have its own database connection, but all the
database connections will be accessing the same database file.

Don't take this analogy too far, however.  When multiple processes open the
same file using fopen(), they can overwrite one another and cause all kinds
of mischief.  But SQLite employs file locking to prevent writes by one
process from interfering with the other processes and to insure that the
database stays consistent, even if some of the connecting processes
misbehave or crash.

-- 
D. Richard Hipp
[email protected]
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to