SQLite multi process access

后端 未结 3 1304
南笙
南笙 2021-02-09 04:32

We are using SQLite in a multi processes and multi threaded application. The SQLite database files are encrypted using the embedded SQLite encryption. The FAQ states that SQLite

3条回答
  •  北荒
    北荒 (楼主)
    2021-02-09 05:11

    Make sure you're not sharing connections across threads - each thread should make it's own connection. And make sure you're wrapping your queries in transactions.

    I use the open-source System.Data.Sqlite (http://sqlite.phxsoftware.com/) ADO.Net wrapper, which is thread-safe as long as you don't share connections across threads. It also easily encrypts the database, as described here: http://sqlite.phxsoftware.com/forums/t/130.aspx (just set the password property). Search his forum for how he specifically uses the Microsoft Crypto API to do encryption, and for details on thread safety.

提交回复
热议问题