SQLite Forum

Database Schema Changed Error
A transaction is related to a connection.  If you have two threads sharing a connection, and one starts a transaction, that transaction includes SQL commands from both threads.

So if both your threads are executing simultaneously, and the timing of the two threads is not coordinated, you have a complicated and unpredictable situation where one thread might <code>COMMIT</code> a transaction at the same time as another thread is executing SQL commands which are inside it.

One cure is to design your own multiplexing to make sure this does not happen.  Another is for each thread to open its own connection.