#1 2015-09-14 08:20:30

StxLog
Member
From: France
Registered: 2015-09-14
Posts: 58

SOLVED - Backup background & Services

Hi,

First of all, i'm working with your library since few month, and everything has been great, congrats for your hard work!

I'm bumping into a little problem though: I'm trying to do a backup of my SQLite databse using your BackupBackground fonction and BackupBackgroundWaitUntilFinished. When i'm running my server application in console mode, everything is doing great and i receive the backup. But if i'm trying the same function from a Windows service, i have a SQLITE_CANTOPEN (14) error on the log file.
Here is a part of my code:

    backupPath := 'DB\backup.s3db';
    if RestServer.DB.BackupBackground(backupPath, 1024, 10, nil) then begin
        RestServer.DB.BackupBackgroundWaitUntilFinished;
        log.Add.Log(sllInfo, 'BACKUP COMPLETE');
        if Self.SendMailBackup() then begin
            log.Add.Log(sllInfo, 'Backup sent');
            SysUtils.DeleteFile(backupPath);
        end;
     end;

Here is the whole error message from the log fle:

20150914 10165325 EXC   ESQLite3Exception ("Error SQLITE_CANTOPEN (14) using 3.8.10.1 with aDB=nil") at 00531991  stack trace API 0048EDE6 00406D0C 77BCD624 77BBAE6F 00531991 00532E70 006B3471 006A239A 006A1A91 006A18B3 00450625 0040778E 77533744 77BAA064 77BAA02F 
20150914 10165325 EXC   ESQLite3Exception ("Error SQLITE_CANTOPEN (14) using 3.8.10.1 with aDB=nil") at 00531991  stack trace API 0048EDE6 00406E94 

thanks in advance for your help !

Last edited by StxLog (2015-09-14 09:52:11)

Offline

#2 2015-09-14 09:06:10

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

Re: SOLVED - Backup background & Services

We did not have any issue when running background backup from a Windows service.
In practice, we don't block the process using BackupBackgroundWaitUntilFinished: we just start the backup, then check that it has been done.

Did you try to use the latest .obj?
Current SQlite3 version is 3.8.11.1.

Please enable .map file creation, to see the stack trace, to understand where the issue occurs.
I guess it is at backup file creation. Perhaps the backup path is not correct... you need a FULL path name: remember that services do not have the same execution context than regular applications (especially about "current folder", which is probably not writable).

Offline

#3 2015-09-14 09:37:54

StxLog
Member
From: France
Registered: 2015-09-14
Posts: 58

Re: SOLVED - Backup background & Services

A big thank you for your help and fast reply! It was, indeed, a path problem.. Sorry to bother you for such a simple problem, i had the same one for the log files few weeks ago and forgot about it


Keep up the great work, thank !

Offline

Board footer

Powered by FluxBB