"Karthik" <[EMAIL PROTECTED]> wrote in
message news:[EMAIL PROTECTED]
> Newbie question regarding in-memory databases. I read in the wiki
> pages that it is not safe to use same db connection across multiple
> threads.

It's actually safe with recent SQLite versions. A lot of issues have 
been eliminated. SQLite know uses a mutex to serialize concurrent API 
calls from multiple threads.

You have to know what you are doing of course. E.g. if one thread starts 
a transaction, then another thread issues some statements, they go into 
that transaction.

> I am trying to use an in-memory database. My understanding
> is that opening a connection with ":memory:" creates the database and
> closing it erases the same. If I were to use one connection per
> thread will i end up creating distinct memory db's for each thread?

Yes.

> is it possible to use a single in-memory db that can be accessed by
> different threads in a multithreaded environment?

The only way is to pass the same db connection between threads.

Igor Tandetnik



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to