Is SQLite.Net thread safe?

I am asking about the implementation of .Net - System.Data.SQLite. Are there any recommendations for using it in a thread-safe manner?

I know that SQLite itself can be compiled with or without thread safety - but how is System.Data.SQLite compiled?

+6
thread-safety sqlite system.data.sqlite
source share
1 answer

It is not thread safe, so you cannot share connection objects or similar streams.

The stream error fixes mentioned in the readme file are associated with multiple streams that use multiple connections (that is, each one) to the same file, as well as any problems or race conditions that may arise.

For example, the thread race condition mentioned for BEGIN and BEGIN IMMEDIATE had a sad effect, which, although the stream released by BEGIN, the other stream released by BEGIN, could eventually have the database before the first. These types of situations have been fixed.

But database connections (oracle, sqlite, ms sql server) in .NET are not thread safe and are not surrounding objects.

+8
source share

All Articles