SQLite Forum

Database Schema Changed Error
Login
We are using System.Data.SQLite dll with version 1.0.111.0 for one of the database operation.

In this operation, we are creating a new sqlite connection with following properties.

var connectionStringBuilder = new SQLiteConnectionStringBuilder { SyncMode = SynchronizationModes.Normal, Version = 3, DataSource = fileInfo.FullName, ReadOnly = false, };

Once we create a new instance of connection, opening the connection and creating a simple table with following query within a transaction.

CREATE TABLE IF NOT EXISTS TestTable( Guid Blob, Increment INTEGER NOT NULL )

Successfully able to create the table.

In our next business logic, we need to query this table to read some data and this call is happening in a another thread using a same connection which is already created during creation of table. This operation is still a synchronous operation.

SELECT Increment FROM TestTable WHERE Guid = @Guid

Problem Statement:

Whenever while executing the above mentioned select statement we are getting following error in Application Console:

"SQLite error <17>: Statement aborts at 9: [SELECT Increment FROM TestTable WHERE Guid = @Guid] Database schema has changed"

Our Analysis on this issue: 1. Whenever this error logs in our console, not getting SQLite Exception or any base exception(verified through our logging mechanism). 2. This error not causing any issues to our workflows. Hence not seeing any side effects or application crash. 3. This error not occurring when we do the SELECT operation second time. Hence error is coming during first SELECT operation only. 4. We are able to see the same error with earlier version of System.Data.SQLite(1.0.102.0)

Workaround we found to avoid this error in console: 1. Create new SQLite connection during SELECT operation. Hence avoiding using the same connection created during table creation.

Our Questions: 1. Why we are seeing this error in Console? 2. Is there any retrying mechanism to prepare the SQL statement in SQLite whenever this error occurs? That's the reason still our application behaving as per the expectation. 3. How critical this error?Do we need to ignore this error?User feels bad to see this error in his console.