Search code examples
delphifirebirddelphi-xe6firedacfirebird-embedded

Connect to Firebird 2.5 embedded using FireDAC


No matter what I do, I cant seem to connect to Firebird 2.5 embedded database using FireDAC. Funny thing is that yesterday it seemed to work, now all of a sudden it just won't.

Rather to rake my head why all of a sudden it ceased to work, I begun rebuilding a clean project, so I can figure out step by step what is going on. I added (copied) the entire contents of the downloaded package from Firebird to my application directory and the database itself of course.

To avoid folder issues, I have set the Delphi environment options to put all the files (and the exe) in the same directory. Then I used the suggestion found in the Firebird *.doc folder and renamed fbembed.dll to fbclient.dll. (On some FireDAC Q&A about the issue I have read that Firedac requires fbembed.dll file. Well, I have tried both ways and it won't work anyway). But let me stick to first issue with fbclient.dll.

To establish a connection, I have dropped on the datamodule a FDPhysFBDriverLink1 and a FDConnection1.

Now the FDPhysFBDriverLink1: It's BaseDriverID is FB. For DriverID, I have tried both suggestions: First with 'FB' and then supplying the full path to the fbclient.dll. None seem to make the difference.

When I go to Firedac Connection editor, and input the path to my database file, I get "Cannot load vendor library (fbclient.dll or fbembed.dll)" error. But both of these files are in the application exe folder (like suggested on Embarcadero site). So, where is FireDAC looking for the files? I am getting a little fed up of Firebird and the FireDAC, as they can't simply explain what must be done for the connection to succeed. All they give is some vague options which none of them work. Add this-add that, and at the end, fail.

So if someone has experience on how to do this with straight forward answer (no links please, I have seen and tried them all), I would very much appreciate it. Trying for days to establish a simple connection is really stupid. I have tried also with UniDAC with similar results. What must I do to accomplish the connection?


Solution

  • It seems the issue was this : FDPhysFBDriverLink1 needs this info :

    BaseDriverID=FB
    DriverID=FB 
    VendorLib=C:\Users\***\Documents\Delphi\FIREBIRD\fbembed.dll
    

    After setting this I could connect the FDConnection1 using these parameters :

    DriverID=FB
    Database=C:\Users\***\Documents\Delphi\FIREBIRD\MYDB.FDB
    User_Name=sysdba
    Password=masterkey 
    Protocol=local