We need to lock our SQLite datafiles at the filesystem level, because our application frequently crashes with "database is locked" error, which is probably due to other processes opening our files. At least we identified Windows Search indexing service and McAffee antivirus.

I have tried exclusive locking mode by
PRAGMA locking_mode=EXCLUSIVE;
but this does not prevent reading and modifying the file from other processes while they are open by SQLite in our process.

After digging in SQLite sources it seems not possible. VFS for Windows always sends these share mode flags to CreateFile.
dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;

Is there any way to achieve this?

We use C# and System.Data.SQLite but there is no problem to call the SQLite functions directly. Desktop application, datafiles are stored in %APP_DATA% subfolder.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to