[Mono-list] Mono.Data.SqliteClient.SqliteSyntaxException: database is locked

Kamil Skalski kamil.skalski at gmail.com
Tue Jun 19 12:25:15 EDT 2007


> I had opened up a single connection, and was doing updates/selects through
> that. I ended up with "library sequence out of error" exceptions. So, I

I do this by caching one connection per thread.

> modified the code such that each query will open up new connection, and then
> run itself. So, "library sequence" exceptions went away, but got overtaken
> by "database locked" ones. So, to do synchronization at the application

Try specifying the Timeout for the connection. I set it to 30seconds,
which is enough for my application. I don't know any other solution
for this issue - probably the best would be to set timeout to
infinite, which I will do by increasing the actual value when needed
;)

def conn = SqliteConnection ($"URI=file://$path,Version=3,busy_timeout=30000");

(this works with the old provider)

> level, I've set the C# locking mechanism to such that
> 1. each table only runs one query at a time, and
> 2. only one write query is being run at a time.
>
> However, all this has done is just to _reduce_ the number of database locked

I think you cannot even do concurrent reads or maybe there is some
place you missed in locking, I'm not sure.

> exceptions. I'm still getting them. Is there a way by which they can be
> eliminated? Mono database page shows that we can use the new library
> System.Data.Sqlite, which is version 3 and apparently doesn't have these
> synchronization issues. However, I've been unable to find the .dll for
> linux. Any help is appreciated.
>

I think I found them at
http://www.go-mono.com/download-stable/sles-9-i586/  or maybe I just
compiled them from source... it's quite easy.
However I experienced a strange (dead) locking issues using the new
provider, which the same code works fine with old provider. I still
don't have time to investigate, but it would be great if somebody else
having concurrent app with sqlite tested it with new provider :D


-- 
Kamil Skalski
http://nazgul.omega.pl


More information about the Mono-list mailing list