#1 2016-05-11 18:06:39

mariomoretti
Member
From: italy
Registered: 2012-01-29
Posts: 88

sqlite db lock

Hi,

while debugging some routines i normally change a field value in a table using an external tool (sqlitespy), to put in it a value that force the code to do what i expect.

My code used a tSQLRestServerDB to access the database , but now i'd like to use interfaced services.

If I use only ORM methods that access the database by the server instance, I may change the data from sqlitespy, but when i start e client session using tSQLHttpCLient, i cannot more do it. The program returns this error :  Sqlite error 5 - database is locked.

I've posted the code. The lock happens in the line fClient.SetUser('User', 'synopse').

I have submitted this post only to understand if this is normal (the framework works without problems) or if this can be dued to some of wrong done defining server or client or so on.

Thanks in advance to anyone.



     if fClient = nil then
     begin
           fClientModel := tSQLModel.create(servizi.Server.Model);  // clone the server model
          tout := params.HTTPTimeout * 1000;
          fClient := tSQLHTTPClient.Create('localhost', Params.httpport, fClientModel, tout, tout, tout);
          if not fClient.ServerTimeStampSynchronize then
          begin
               result := nil;
               ShowMessage(UTF8ToString(fClient.LastErrorMessage));
               exit;
          end;
          fClient.SetUser('User', 'synopse');
          fClient.ServiceDefine([ICDAnagraphics], sicClientDriven);
          fClient.OnAuthentificationFailed := RetryAfterTimeout;
     end;

Offline

#2 2016-05-12 15:45:04

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: sqlite db lock

The SQLite3 file is locked in exclusive mode, for better performance.
See http://synopse.info/files/html/Synopse% … ml#TITL_60

Offline

#3 2016-05-12 16:10:55

mariomoretti
Member
From: italy
Registered: 2012-01-29
Posts: 88

Re: sqlite db lock

tx  very much.

Offline

Board footer

Powered by FluxBB