Shared Cache Mode or Unlock Notification

Shared Cache Mode or Unlock Notification

Postby ML_hQ » Fri 30 Aug 2013 14:05

Hello Devart-Team,

I'm trying to handle multiple connections to a single database. My problem is the "database is locked" ESQLiteError, which occurs whenever the database is exclusively locked (during writing). According to the SQLite homepage ( there are two possibilities for me:

1. Unlock Notify (
Using Unlock Notify would enable me to queue my posts and solving the problem smoothly.
Is there a simple implementation for this in DBExpress? Could you give me a code sample for it? And is there a disadvantage (besides the ones listed on the homepage) by using Unlock Notify?

2. Shared Cache Mode (
I'm not sure if this would fix my problem, but I'm willing to try it. As we are using multiple database types over DBExpress, I can't use the TSQLiteConnection. Instead I'm using the TSQLConnection from SqlExp.pas. Is there a possibilty to use Shared Cache Mode with this kind of connection? Or does it only work with the TSQLiteConnection?

Thanks in advance an best regards
Posts: 2
Joined: Fri 30 Aug 2013 13:35

Re: Shared Cache Mode or Unlock Notification

Postby AlexP » Fri 30 Aug 2013 15:30


For the time being, we don't support Unlock Notification, since the standard SQLite library available at the developers website is compiled without support for this functionality.
Yes, you can use the Shared Cache mode. For this, you should set the TSQLConnection EnableSharedCache property to True (see Readme.html)
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Shared Cache Mode or Unlock Notification

Postby ML_hQ » Mon 02 Sep 2013 13:16

Thank you for your help!

The EnableSharedCache property can't be set for TSQLConnection, as it is an TSQLiteConnection exclusive property.

But using the ReadMe I found another solution:
Code: Select all
SQLConnection1.SQLConnection.SetOption(coEnableSharedCache, integer(True));

This seems to work. I'll have to run some more tests before I can definitely say if the problem is fixed.
Posts: 2
Joined: Fri 30 Aug 2013 13:35

Return to dbExpress driver for SQLite