[sqlite] in Linux system, 2 threads can access 2 separate databases (created by sqlite3) through sqlite3?

2015-05-22 Thread Kees Nuyt
On Thu, 21 May 2015 17:54:50 +0800 (CST), "miles zhang"
 wrote:

>dear,
>thanks for your reading.
>I have 2 different databases ,  and I create 2 threads
>to access such 2 databases with sqlite3 sql statement??

You do not have to create a thread for each database connection,
but it is possible. You would sqlite3_open() one database in
each thread, each database gets its own handle.

>   can it be done successfully like this using sqlite3 lib?

Yes.

>   is it need to control access of such 2 thread for competition ?
> for example , locker.

No, database connections are independent. Synchronization
between them is done with file locking that sqlite provides
automatically.

You would only have to synchronize between the threads (with a
mutex) if they both use the same database connection.


>   thx,
>   hope your reply soon.
>
>   miles zhang
>   2015-05-21

-- 
Regards,

Kees Nuyt


[sqlite] in Linux system, 2 threads can access 2 separate databases (created by sqlite3) through sqlite3?

2015-05-21 Thread miles zhang
dear,
thanks for your reading.
I have 2 different databases ,  and I create 2 threads to access such 2 
databases with sqlite3 sql statement?
   can it be done successfully like this using sqlite3 lib?
   is it need to control access of such 2 thread for competition ? for example 
, locker.

   thx,
   hope your reply soon.

   miles zhang
   2015-05-21