Driver Configuration (AnyDAC)
From RemObjects Software
This is a AnyDAC Architecture entry
Feel free to add your notes to this topic below.
Contents |
Driver configuration file
To adjust a driver's behaviour, you can use the driver configuration file. This file is in standard INI text file format and needs to be edited manually. Basically, driver configuration file allows:
- adjust parameters of base driver (section name = base driver ID);
- introduce new virtual driver, which is the base driver and set of driver parameters saved under new name (section name = new virtual driver ID).
By default, the file is located in $(ADHome)\DB\ADDrivers.ini. Here is the sample of the driver configuration file content:
[ASA] ; ASA base driver will use specified ODBC driver ODBCDriver=Adaptive Server Anywhere 8.0 [Ora815] ; Ora815 virtual driver will use specified Oracle Home BaseDriverID=Ora VendorHome=OraHome815 [MySQL327] ; MySQL327 virtual driver will use specified LIBMYSQL.DLL BaseDriverID=MySQL VendorLib=c:\LIBMYSQL327.DLL [MSSQL_2000] ; MSSQL_2000 virtual driver will use specified ODBC driver BaseDriverID=MSSQL ODBCDriver=SQL SERVER ODBCAdvanced= [FB21] ; FB21 virtual driver will use specified Firebird client library BaseDriverID=IB VendorLib=C:\ib\fb21\bin\fbclient.dll [FB21_Embedded] ; FB21 virtual driver will use specified Firebird client library BaseDriverID=IB VendorLib=C:\ib\fb21_embed\bin\fbembed.dll
AnyDAC searches for the driver configuration file in the following places:
- ADDrivers.ini in the application EXE folder.
- If file above is not found, then looks for the file specified in the registry key HKCU\Software\RemObjects\AnyDAC\DriverFile. By default, it is $(ADHome)\DB\ADDrivers.ini.
At design time, AnyDAC will use the file in Delphi Bin folder or as specified in the registry.
Base and Virtual Drivers
If the driver configuration file section name is the base driver ID (like “ASA” in the sample above), the base driver uses the parameter values specified in the corresponding section.
If the section name is not an ID of the base driver (like “Ora815” above), AnyDAC registers the additional virtual driver. The virtual driver uses the base driver implementation specified in the BaseDriverID parameter and the parameter values specified in the corresponding section. A virtual driver ID may then be used as the value of the DriverID connection definition parameter. A virtual driver allows an application:
- To work with different versions of DBMS client software in different connections, established in the same application run. For example, to connect to Interbase and Firebird servers.
- To choose an explicit version of DBMS client software. For example, to use one of the many LIBMYSQL.DLL’s installed on workstation.
Driver Configuration Parameters
The following parameters may be specified as the driver configuration parameters:
| | | |
|---|---|---|
| VendorHome | The Oracle home name. | Ora |
| The base installation path. For example: C:\ib\ib2007. |
| |
| VendorLib | The DBMS client software API DLL name. For example: libmysql510.dll. |
|
| ODBCDriver | ODBC driver name. For example: Adaptive Server Anywhere 8.0. | All ODBC based |
| ODBCAdvanced | ODBC driver additional parameters.
The string consists of ODBC driver parameters delimited by ‘;’. Check the vendor documentation for possible values. | All ODBC based |
If the VendorLib is explicitly specified, then AnyDAC will use the specified DLL as the DBMS API DLL. If the VendorHome is explicitly specified, then the DLL with default name from Bin subfolder will be used. If none is specified, then will be used DLL with default name from:
- primary Oracle Home for Ora driver;
- most left folder in PATH environment variable, containing the DLL.
Configuring Drivers at design or run time
You can also configure AnyDAC drivers at design time or in code at run time. For that drop appropriate TADPhysXXXDriverLink component to your form. It has the same named properties, as the parameters in the driver configuration file. Setting them will have effect before first connection to a DBMS.
See Also
Glossary — Features — How To — Components — Tools — Samples — Articles — Architecture — Issues
Categories: Text | AnyDAC | Architecture | Driver
