sqlitedelphifiredac

Sqlite Firedac Database always locked when running in Delphi 10.3 IDE - Compiled Executable works fine


I am having difficulty with a Firedac Sqlite Database in Delphi 10.3.1

I am using the Dbnavigator and DbGrid to enter new records directly into the selected table. Each time I try and post the new record, I get a Firedac error message 'Error: database is locked' This also happens when I try to delete a record. This only happens when the IDE is running. I have read several posts across many forums highlighting the same issue. I have tried altering the Locking Mode settings, but the problem still persists. It is quite frustrating to have to leave the IDE, run the executable, test and re-enter the IDE to debug.

Any help would be much appreciated.


Solution

  • The "database is locked" message arises if you have the Sqlite database, or the table within it, open in the IDE; that places a lock on the database which your app detects and complains about at run-time.

    The solution is simple: make sure that the table is not open in the IDE and that the FireDAC connection to it is not active either.