BigONotation
BigONotation

Reputation: 4538

How to use Firedac in console application?

I have created a very simple console app and trying to access a Firebird database using Firedac. I am trying to implement connection pooling using a private definition setup as explained here: http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Multithreading_(FireDAC). I have also made sure to include FBclient.dll in my path

The code for initializing the connection is given next:

oParams := TStringList.Create;
oParams.Add('localhost:C:\fb\ADDEMO_FB21.FDB');
oParams.Add('User_Name=sysdba');
oParams.Add('Password=masterkey');
oParams.Add('Pooled=True');
FDManager.AddConnectionDef('Firebird Pooled','FB',oParams);

// necessary for enabling multithreaded access

FDManager.Active := True;

When this code executes FDManager.AddConnectionDef(), I am getting an exception 'Object factory for class xxx is missing' (see attached screenshot):

enter image description here

This is a console app, so I have no Form or visual elements. Not sure how to proceed?

Upvotes: 2

Views: 1541

Answers (1)

BigONotation
BigONotation

Reputation: 4538

OK figured it out. I was only adding FiredAC.Comp.Client in my uses clause. It seems that Firedac needs a whole bunch of units. Updated my uses clause as follows:

FireDAC.Comp.Client,
  FireDAC.Stan.Intf, FireDAC.Stan.Option,
  FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Stan.Def,
  FireDAC.Stan.Pool, FireDAC.Stan.Async, FireDAC.Phys, FireDAC.Phys.FB,
  FireDAC.Phys.FBDef, FireDAC.VCLUI.Wait, Data.DB;

Upvotes: 5

Related Questions