[Mono-dev] Mono.Data.Sqlite

Joe Audette joe.audette at gmail.com
Thu Jul 3 20:23:29 EDT 2008


My impression is that SQLite is not that great a choice for a multi
threaded app. If you google sqlite mutli threading, in the first
result which links to here:


you'll see:
"It has never been safe to use the same database connection
simultaneously in multiple threads."

Sqlite is really meant to be a lightweight db for single threaded apps.

Hope it helps,


On Sun, Jun 29, 2008 at 6:16 AM, Anders Aagaard <aagaande at gmail.com> wrote:
> Hi
> I've been using Mono.Data.Sqlite in a multi threaded application, since the
> code says it's based on Robert Simpson's library I've been looking at his
> page for documentation (as Mono.Data.Sqlite documentation seems extremely
> sparse).
> My problem is that when using multiple threads, all writing to the database,
> I get :
> Unhandled Exception: Mono.Data.Sqlite.SqliteException: The database file is
> locked
> Every thread has it's own cloned SqliteConnection (during the creation of
> the thread I call MasterConnection.Clone (), and only use the referenced
> connection).  The exception happens instantly when two threads begin a
> transaction to the same database.
> Is the instructions for Robert Simpson's library not accurate for mono's
> sqlite library, or am I hitting a bug?  Any suggestions on how to cleanly
> work around this problem?
> I have one file scanner that adds files to the database, one text file
> scanner that scans all text files added and adds web links from them, and
> one web updater that takes the links and updates that from an online
> database.  They are all seperate threads.  The main thread will also
> occasionally do a small commit, but it will mostly read from the database.
> --
> View this message in context: http://www.nabble.com/Mono.Data.Sqlite-tp18179121p18179121.html
> Sent from the Mono - Dev mailing list archive at Nabble.com.
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list

Joe Audette
Software Solutions Architect
Source Tree Solutions, LLC
PO Box 621861
Charlotte, NC 28262
joe.audette at gmail.com

More information about the Mono-devel-list mailing list