Hm...

Hm... 
I have a Firebird database - locally on my PC.
The FireDAC connection to the database, the transactions and for example component like TFDQuery... all they work fine.

But when I try to use the component "TFDFBNBackup" - I received a strange error message:
"[FireDAC][Phys][FB]Cannot attach to services manager
Services functionality will be supported in a later version  of the product"

Details:
Windows7x64
Firebird 2.1.7.18553 (x64)

Source code:

FDFBNBackup1.DriverLink := FDPhysFBDriverLink1;
FDFBNBackup1.UserName := 'sysdba';
FDFBNBackup1.Password := 'masterkey';
FDFBNBackup1.Host := '192.168.9.24';
FDFBNBackup1.Protocol := ipLocal;
FDFBNBackup1.Port:=3050;

FDFBNBackup1.Database := 'D:\FD_TESTS.FDB';
FDFBNBackup1.BackupFile := 'D:\fd_test.backup';
FDFBNBackup1.Level := 0; // full backup

FDFBNBackup1.Backup;

Is this a bug? Or not (my mistake)?
... Help?

Comments

  1. Does Firebird have a services layer for backups and jobs?  I haven't tried the Backup component, so I can't say - but I'd try it against other databases, to figure out if it is the Firebird physical driver which is unable to do it, which sounds likely - or if it is a Firebird feature that is not exposed for third party.

    ReplyDelete
  2. Lars Fosdal I can't find any limitation for the local usage:
    http://www.firebirdsql.org/manual/nbackup.html
    "Except when the Services Manager is used (in Firebird 2.5+) backing up with nbackup requires direct access to the database file."

    For me these lines:
    FDFBNBackup1.Protocol := ipLocal;
    FDFBNBackup1.Database := 'D:\FD_TESTS.FDB';
    means a direct access to the DB. 
    :(

    ReplyDelete
  3. For TFDFBNBackup you need Firebird 2.5
    It will not work on 2.1

    ReplyDelete
  4. Did you try localhost?

    FDFBNBackup1.Host := '127.0.0.1;

    ReplyDelete
  5. Oliver Funcke Yep - not working. The same with a "localhost"

    ReplyDelete
  6. Friedrich Westermann And... yes! The same project work fine under 2.5 
    :) Thanks a lot - It was time for migration to 2.5

    ReplyDelete
  7. If you're connecting locally you need to set FDFBNBackup1.host to an empty string. If this doesn't fix it, let me know and I can send you some working code.

    ReplyDelete
  8. Paul Thornton Ok but I can't test this case till Monday, afternoon. Currently I just do not have access to my workstation.
    10x

    ReplyDelete
  9. Are you trying to connect to an FBEmbedded dll? If so, the above should work. If you're connecting to a Firebird server you need to set host to the IP of the server and the protocol to ipTCP not ipLocal, even if the server is on the same machine as the client.

    The component you are using looks like it's for an incremental backup. If you want a normal backup, use TFDIBBackup. You probably know this, but I thought it was worth mentioning :)

    ReplyDelete
  10. Paul Thornton For my case the embedded library isn't an option - only the server case. Also... I tried the case with the IP address and the ipTCP. With the real IP and with the localhost also... and with 127.0.0.1 and so on. The same result...
    And - you are right I want to use an incremental backup. :)
    Look at the opinion of Friedrich Westermann.: "For TFDFBNBackup you need Firebird 2.5 It will not work on 2.1". He did not say why, but ... I figured it was something specific for this component. Something that is just written somewhere (RTFM?) - something which I have not read. :)
    About the transportable backup with TFDIBBackup - I use it for migration to a new version of the server and periodically for sweeping and compacting the database.

    But... :) nBackup is more fast and convenient for the daily use (for me). 
    Until now I use it with my own implementation which is... well it just isn't a perfect solution for my new project. :)

    ReplyDelete
  11. Dobrin Petkov
    Ok i will answer:
    TFDFBNBackup is a new future from FB 2.5.It was not there before, so it can only work on > FB 2.5. 

    Here is a function i'm using:

    function CreateDriverLink(var aDriver: TFDPhysIBBaseDriverLink; const aClientlib: String): boolean;
    begin
      result := false;
      if Tfile.Exists(aClientlib) then
      begin
        aDriver := TFDPhysFBDriverLink.Create(nil);
        aDriver.VendorLib := aClientlib;
        result := true;
      end;
    end;


    function doFibBackupFDN(const afromfile, atofile, aClientlib, aUser, aPasswort: string): boolean;
    var
      lBackup: TFDFBNBackup;
      lDriverlink: TFDPhysIBBaseDriverLink;
    begin
      result := false;
      if CreateDriverLink(lDriverlink, aClientlib) then
      begin
        try
          lBackup := TFDFBNBackup.Create(nil);
          try
            lBackup.DriverLink := lDriverlink;
            lBackup.Options := [];
            lBackup.Database := afromfile;
            lBackup.BackupFile := atofile;
            lBackup.UserName := aUser;
            lBackup.Password := aPasswort;
            try
              lBackup.Backup;
            except
              on e: exception do
                debugsAllways(e.Message);
            end;

            result := true;
          finally
            lBackup.free;
          end;
        finally
          lDriverlink.free;
        end;
      end;
    end;

    These source is running on more than 6000 clients so i think it should work :-)

    ReplyDelete
  12. Many thanks Friedrich!
     :)
    I didn't know that this is a relatively new component - your post finally solved this... "issue" . My project already is on the way to the new version of the SQL server.

    ReplyDelete

Post a Comment