Can different connections of the same sqlite database trigger transactions at the same time?

I am having a strange problem with sqlite3. I got different connections of the same database file using the open () method. connection 1 starts the transaction, and connection 2 starts another transaction, which should update several table entries. Then connection 1 commits the transaction, and then connection 2 completes the transaction. But I found that the connection update command 2 never updates the record in the database. An exception is not excluded during this procedure. I do not know why the problem arises. Can someone explain the reason to me?

+7
sqlite transactions
source share
2 answers

If you read the SQLite documentation, you will see that it supports multiple read-only connections, you cannot write to the database from multiple connections because they are not intended for this.

http://www.sqlite.org/faq.html#q5

+14
source share

If you do not use BEGIN IMMEDIATE to initiate transactions, you risk rolling back and retrying. BEGIN does not block; subsequent UPDATE or INSERT gets the lock, and you need to check the result code to see if they worked. See this page in the transaction , and this one will block .

+5
source share

All Articles