-----Original Message----- >From: Salles, Joaquim Campos [mailto:[EMAIL PROTECTED] >Sent: quinta-feira, 8 de novembro de 2007 11:45 >To: sqlite-users@sqlite.org >Subject: [sqlite] is safe to use the same database connection at the same >time in more than one thread?
>Is safe to use the same database connection at the same time in more >than one thread? Hello, I found two e-mails (bellow) that I think give the answer: yes is safe to use the same database connection, but is not work in the way that I imagined. "Transaction control is per connection, not per thread." (Igor Tandetnik) or "That connection can then be used across threads, but it is for all intents and purposes a single line of communication with a database (using it twice at the same time doesn't somehow multiply that relationship)". (Stephan Beal) My interpretation is correct? Probably is a good idea to review Multi Threading page (http://www.sqlite.org/cvstrac/wiki?p=MultiThreading) and alert about the characteristic :treath safe and Transaction control is per connection Best regards, Joaquim Reference: http://www.mail-archive.com/sqlite-users%40sqlite.org/msg28858.html You're confusing threads with the context of the connection. When you call sqlite3_open() you get a single connection to a db. That connection can then be used across threads, but it is for all intents and purposes a single line of communication with a database (using it twice at the same time doesn't somehow multiply that relationship). stephan beal http://www.mail-archive.com/sqlite-users%40sqlite.org/msg28868.html That would happen if thread B had its own, separate connection, but not when the two threads are working with the same connection. As far as SQLite is concerned, there's no difference between a single thread making two changes to the database within a single transaction, or two threads each making one change. Transaction control is per connection, not per thread. Igor Tandetnik ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------