AnyDAC
ContentsIndexHome
PreviousUpNext
TADManager and TADConnection Questions

The list of questions and answers related to TADManager and TADConnection.

Group
Links
QC1: I have a base datamodule class with TADManager. When I am creating a descendant class, I am getting »Application must have only single ADManager« error. What is wrong ?

A: You can only have one ADManager in a application. Instead of explicit creating that in your classes, refer a singleton object via ADManager function. 

 

QC2: However in my project group I have several different delphi projects (applications), each with its own DataModule and ADManager. If I happen to open more than one of these datamodules at the same time (say to copy or compare items) then I get an error saying, that you can only have one ADManager per application, and it promptly removes one of them from one of the DataModules.

A: Do you really need the TADManager's ? An application does not need to explicitly create the TADManager. It is required to set the options and the configuration files in design time. 

 

QC3: Can this be fixed, I keep on loosing my ADManagers and having to recreate them.

A: No, this cannot be fixed. Because only single TADManager may be created at design or run time. If there will be few TADManager's, then AnyDAC will not know which one to use. Also see QC1. 

 

QC4: Does AnyDAC supports a connection pooling?

A: Yes, it has. In general, connection pooling keeps a pool of open "physical" connections, and when TADConnection.Connected is set to True, then AnyDAC takes a "physical" connection from the pool and uses it. When application is set TADConnection.Connected to False, the "physical" connection is not closed, but put back into pool. 

To use connection pooling in AnyDAC, just add Pooled=True to you connection definition. No more special actions your application should take. Read Multi Threading for details. 

 

QC5: Connection Editor seems to ignore ADPhysIBDriverLink1.VendorLib and uses hard coded driver.

A: You have to set VendorLib before first connection using this driver. After a connection is established, the DBMS client is loaded. 

At design-time to make sure that your TADPhysXXXDriverLink properties are in the usage, check that TADPhysXXXDriverLink is first in the data module / form creation order. Then optionally restart Delphi IDE. 

At run-time use the driver link Release method: 

 

ADConnection1.Close;
...
ADConnectionN.Close;

ADPhysIBDriverLink.VendorLib := 'c:\fbclient.dll';
ADPhysIBDriverLink.Release;

ADConnection1.Open;
...
ADConnectionN.Open;

 

Other option is to define a virtual driver. Read the following for details Configuring Drivers. For example: 

 

[FB_Embedded]
BaseDriverID=IB
VendorLib = C:\fb\fbembed.dll

 

And use FB_Embedded driver as a DriverID at design time. At run time you can also use ADDrivers.ini or just configure TADPhysXXXDriverLink.

What do you think about this topic? Send feedback!