views:

46

answers:

1

I have an application I'm porting from MSSQL and .NET to SQLite and Mono. I'm using NHibernate, FluentNHibernate, NHibernateLINQ and SQLite.

When I test the application with only one person connected everything works OK, but the moment somebody else starts using the app it breaks and throws an SQLite Exception saying "Database File is Locked".

I know that SQLite locks the database when a write is being made and returns a busy status, I'm guessing maybe I haven't configured NHibernate correctly to handle this, but I can't find any information online that has helped so far. It's like I'm the only person with this problem. Am I ? Any ideas ?

Thanks

A: 

I suspect your problem is not FNH per se.

I had a similar problem in my FNH / SQLite project (.NET, not Mono). It mysteriously fixed itself after I refactored some of the session management code for other reasons. (The main changes were to use Transactions for ALL DB access, and to ensure all Transaction and Session objects were properly Disposed).

This link discusses a similar problem that was caused by a missing Dispose. I suspect that may have been my problem, but am not sure. (Just keeping my fingers crossed that the problem does not reappear!).

Another good source of things to try is http://stackoverflow.com/questions/1224325/database-file-is-inexplicably-locked-during-sqlite-commit

Tom Bushell