Connect to Firebird (FireDAC)
Go Up to Database Connectivity (FireDAC)
This topic describes how to connect to Firebird database.
Contents
Supported Versions
The FireDAC native driver supports the Firebird server and the embedded editions version 1.5 and later. It does not officially support Jaffil.
To connect to InterBase, use the FireDAC InterBase driver.
Windows Client Software
FireDAC requires the following x86 or x64 client software to be installed on the workstation:
- The FBCLIENT.DLL library to connect to the Firebird server. You can take it from a server (download) installation Bin folder.
- The FBEMBED.DLL library to work with the database using the Firebird Embedded server (details).
Note: It is critical to use the appropriate DLL for the DBMS client library. Do not use GDS32.DLL with Firebird or FBCLIENT.DLL with InterBase.
You can put the required files in:
- a folder listed in your PATH environment variable (for example, <Windows>\SYSTEM32)
- your application EXE folder
Alternatively you may put the required files in any other folder, and specify their path in FDDrivers.ini:
[FB]
VendorLib=<folder>\fbclient.dll
If the Firebird client library has not been installed properly, an exception is raised when you try to connect:
OS X Client Software
FireDAC requires:
- the libfbclient.dylib x86 client library to connect to the Firebird server. You can take it from a server (download) installation /Library/Frameworks/Firebird.framework/Libraries folder.
Driver Linkage
To link the driver:
- Drop the TFDPhysFBDriverLink and TFDConnection components from the Tool Palette
- or include the FireDAC.Phys.FB unit in the uses clause.
Connection Definition Parameters
To connect to the Firebird DBMS, most applications require that you specify the DriverID, Protocol, Server, Database, User_Name, Password, and CharacterSet connection definition parameters (see Defining Connection (FireDAC) for details).
DriverID=FB
Parameter | Description | Example value |
---|---|---|
Database |
The database name to attach. The value can be:
For an embedded database, a path can include path variables. |
|
OSAuthent |
Controls authentication mode:
For details, see the doc\README.trusted_authentication.txt. |
Yes |
User_Name | The user name. | sysdba |
Password | The user password. | masterkey |
CharacterSet | Specifies the character set to use. We strongly recommend you to explicitly set the CharacterSet parameter to one of the following values:
|
WIN1252 |
ExtendedMetadata |
Controls the extended description of the query result sets:
|
False |
Port |
The TCP/IP port on which the Interbase server is listening. By default, it is equal to 3050. When it is differrent, then you should set the "Port" parameter to the required value. |
3051 |
Protocol |
The protocol used to connect to the DB server. This parameter can take one of the following values:
If the Protocol parameter is specified, FireDAC builds full database paths, using the appropriate Protocol format and Server and Database parameter values. |
TCPIP |
Server | Server address to connect to. The Server parameter value is used only if the Protocol parameter is specified. To specify a TCP/IP port number use the <host>/<port> notation. |
|
SQLDialect | The SQL Dialect to use for connecting. Three is the default value. | 1 |
RoleName | The default role name. | Admin |
OpenMode |
Specifies how to open a database. The following modes are supported:
|
Open |
DropDatabase |
Controls the deletion of an existing database:
|
Yes |
PageSize | The page size used for the newly created database if CreateDatabase = Yes. 1024 is the default value. | 4096 |
IBAdvanced | The ';' separated list of additional parameters. You can find the full list of supported parameters in the FireDAC.Phys.IBWrapper unit (see the DPBInfos constant array). You can find the description of each Code listed there in the Interbase/Firebird manuals. |
Use Cases
- Connect to a database running on a remote server via TCP/IP protocol:
DriverID=FB Database=C:\fb\ADDEMO_FB21.FDB Protocol=TCPIP Server=FBSrv User_Name=sysdba Password=masterkey CharacterSet=win1252 ExtendedMetadata=True
- Connect to a database running on a remote server via TCP/IP protocol:
DriverID=FB Database=FBSrv:C:\fb\ADDEMO_FB21.FDB User_Name=sysdba Password=masterkey CharacterSet=utf8
- Connect to a local database:
DriverID=FB Database=C:\fb\ADDEMO_FB21.FDB User_Name=sysdba Password=masterkey CharacterSet=win1251
- Connect to a Firebird Embedded database:
Drop the TFDPhysFBDriverLink component to the form and set its VendorLib to <your path<\fbembed.dll or use a virtual driver definition.
DriverID=FB Database=C:\fb\ADDEMO_FB21.FDB User_Name=sysdba CharacterSet=utf8
See Also
- Common Connection Parameters
- FAQs
- How to configure FireDAC Drivers
- How to manage FireDAC Connection Definitions
- Tutorial: Using FireDAC from a Multi-Device Application on Desktop Platforms
Samples
- FireDAC Firebird sample