#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    4
    Rep Power
    0

    Firebird and Borland Dev 2006


    I've tried in delphi section with no answer, so I'm trying in FB section.

    I'm using the 2 delphi components to backup and restore a firebird DB.
    I have 2 functions that handle the 2 services:

    function TdataModule1.Backup(const src: string; const dest: string) : boolean;
    begin
    Result := true;
    IBBackupService1.BackupFile.Clear;
    IBBackupService1.ServerName := '';
    IBBackupService1.DatabaseName := src;
    IBBackupService1.BackupFile.Add(dest);
    IBBackupService1.Attach;
    try
    IBBackupService1.ServiceStart;
    while not IBBackupService1.Eof do
    begin
    IBBackupService1.GetNextLine;
    end;
    IBBackupService1.Detach;
    except
    IBBackupService1.Detach;
    Result := false;
    end;
    end;

    function TdataModule1.Restore(const src: string; const dest: string) : boolean;
    begin
    Result := true;
    IBRestoreService1.DatabaseName.Clear;
    IBRestoreService1.BackupFile.Clear;
    IBRestoreService1.ServerName := '';
    IBRestoreService1.DatabaseName.Add(src);
    IBRestoreService1.BackupFile.Add(dest);
    IBRestoreService1.Attach;
    if IBrestoreService1.Active = true
    then
    begin
    try
    IBRestoreService1.ServiceStart;
    while not IBRestoreService1.Eof do
    begin
    IBRestoreService1.GetNextLine;
    end;
    if IBRestoreService1.Active
    then IBRestoreService1.Detach;
    except
    IBRestoreService1.Detach;
    Result := false;
    end;
    end;
    end;


    When I call BACKUP everything goes ok. I have a new backup file and If I check it with some external progs (IBExpert, gbak) the file looks ok and valid.

    But when I call RESTORE I got an error: "Expected backup description record" and the functions exits.
    If i try to restore the created file (with my Backup function) with an external prog (IBEXPERT or gbak) everything goes ok.

    So BACKUP function works perfectly, but restore one has some kind of problem reading the backup file.

    Someone could explain what's wrong with my backup file or otherwise the kind of error received... I can't find documentation about it, I only understand that is something related to a signature.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2006
    Location
    Plovdiv. Bulgaria
    Posts
    226
    Rep Power
    13
    From some versions Delphi's components are not compatible with Firebird - only with Interbase. Maybe this is the problem. Are you sure that RestoreService uses Firebird's gbak and not Interbase's? If you can, try to use another components library like FIBPlus or some free components to check will the error occur.

    But first try to use -replace switch when restoring the database. If the srs is the same in both functions and the database file exists whne you restoring the backup, you have to use -rep to replace the existing database file.

IMN logo majestic logo threadwatch logo seochat tools logo