Connect to InterBase (FireDAC)

From RAD Studio
Jump to: navigation, search

Go Up to Database Connectivity (FireDAC)

This topic describes how to connect to Embarcadero InterBase.

Supported Versions

The FireDAC native driver supports Embarcadero InterBase Server, Desktop, Developer, ToGo, and IBLite editions version 6 and later.

To connect to Firebird or to the Jaffil server, use the FireDAC Firebird driver.

Client Software

Windows Client Software

FireDAC requires the following x86 or x64 client software to be installed on the workstation:

  • InterBase Server:
    • Win32: The GDS32.DLL library to connect to the InterBase Server, Desktop, or Developer from x86 applications.
    • Win64: The IBCLIENT64.DLL library to connect to the InterBase Server, Desktop, or Developer from x64 applications.
  • InterBase ToGo:
    • Win32: The IBTOGO.DLL library to work with the database using the embedded InterBase ToGo from x86 applications.
    • Win64: The IBTOGO64.DLL library to work with the database using the embedded InterBase ToGo from x64 applications.

You can put the required files in:

  • a folder listed in your PATH environment variable (for example, <Windows>\SYSTEM32).
  • your application EXE folder.
  • any other folder and specify in FDDrivers.ini:
[IB]
VendorLib=<folder>\gds32.dll

If the InterBase client library has not been installed properly, an exception is raised when you try to connect:

[FireDAC][Phys][IB]-314. Cannot load vendor library [gds32.dll]. The specified module could not be found.
Check [gds32.dll], which is located in one of the PATH directories or in the application EXE directory.

macOS Client Software

FireDAC requires:

  • the libgds.dylib x86 client library to connect to the InterBase server. With RAD Studio, use Project > Deployment > Add Featured Files > InterBase Client\OSX32.
  • the libibtogo.dylib x86 embedded InterBase. With RAD Studio use Project > Deployment > Add Featured Files > InterBase ToGo\OSX32.

iOS Client Software

FireDAC requires:

  • For 64-bit iOS Device - the libibtogo.a embedded InterBase as ARM static library. With RAD Studio use Project > Deployment > Add Featured Files > InterBase ToGo\iOSDevice64.

Note that it is impossible to choose the linkage mode.

Android Client Software

FireDAC requires:

  • the libibtogo.a embedded InterBase as ARM static library. With RAD Studio use Project > Deployment > Add Featured Files > InterBase ToGo\Android.

Note that it is impossible to choose the linkage mode.

Linux Client Software

FireDAC requires:

  • the libgds.so x64 client library to connect to the InterBase server. With RAD Studio, use Project > Deployment > Add Featured Files > InterBase Client\Linux.
  • the libibtogo.so x64 embedded InterBase. With RAD Studio use Project > Deployment > Add Featured Files > InterBase ToGo\Linux.

Driver Linkage

To link the driver:

Connection Definition Parameters

To connect to InterBase, 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=IB or DriverID=IBLite

Parameter Description Example value
Database

The database name to attach. The value can be:

  • database file path.
  • full database path, including server address.

For an embedded database, a path can include path variables.

  • C:\ib\ADDEMO_IB2007.IB
  • 127.0.0.1:C:\ib\ADDEMO_IB2007.IB
  • \\MySrv\C:\ib\ADDEMO_IB2007.IB
OSAuthent
Note: Only for DriverID = IB.

Controls the authentication mode:

  • Yes -- use Windows authentication.
  • No -- use DBMS authentication. It is the default value.
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:
  • UTF8, if your application needs to support Unicode. For details, see Unicode Usage (FireDAC).
  • WIN1250 for Central Europe.
  • WIN1251 for Cyrillic.
  • WIN1252 for Western Europe, America.
  • and so on.
WIN1252
ExtendedMetadata

Controls the extended description of the query result sets:

  • True -- FireDAC is getting column domain names additional to the other column attributes. If a column belongs to a domain with a name such as %BOOL%, it is described as dtBoolean. Also, if a table has an INSERT trigger, which reads a single sequence and assigns its value to a single column, then this column is described as an auto-incrementing one. Setting this option to True slightly slows down a dataset opening.
  • False -- FireDAC uses the restricted information about the query columns. It is the default value.
False
Port
Note: Only for DriverID = IB.

The TCP/IP port on which the InterBase server is listening. By default, the port is equal to the gds_db defined in services. Typically, it is equal to 3050. When gds_db is not defined, then you should set the Port parameter to the required value.

3051
Protocol
Note: Only for DriverID = IB.

The protocol used to connect to the DB server. It can be one of the following values:

  • Local -- connect to a locally running server, to an embedded server, or to a server using an alias.
  • NetBEUI -- connect using Microsoft NetBIOS protocol.
  • SPX -- connect using Novell SPX protocol.
  • TCPIP -- connect using TCP/IP protocol.

If the Protocol parameter is specified, FireDAC builds full database paths using the appropriate Protocol format and the Server and Database parameter values.

TCPIP
Server
Note: Only for DriverID = IB.

Specifies the server address to connect to. The server parameter value is used only if the Protocol parameter is specified.

127.0.0.1
InstanceName
Note: Only for DriverID = IB.

The InterBase instance name. Supported starting from InterBase 2007.

srv2
SQLDialect
Note: Only for DriverID = IB.

The SQL Dialect to use for connecting. Three is the default value.

1
RoleName
Note: Only for DriverID = IB.

The default role name.

Admin
OpenMode

Specifies how to open a database. The following modes are supported:

  • Open -- opens an existing database file specified in the Database parameter, immediately after connecting to the server. If the specified database does not exist, the application throws an exception. It is the default value.
  • Create -- creates a new database. If the specified database exists, the application throws an exception.
  • OpenOrCreate -- opens an existing database or creates a new database if the specified database does not exist.
Open
DropDatabase

Controls the deletion of an existing database:

  • Yes -- drop the database file specified in the Database parameter, immediately after disconnecting from the server.
  • No -- do not drop. It is the default value.
Yes
PageSize The page size used for the newly created database if CreateDatabase = Yes. 4096 is the default value. 8192
IBAdvanced The ';' separated list of additional parameters. You can find the full list of the 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 manuals.
GUIDEndian It defines how the GUID value is represented on the client. 'Little' is the default value. Big

Use Cases

Using a Secure Connection

To use TLS/SSL encryption, pass the key-value pair ssl=true on the value of the Database parameter as follows:

DriverID=IB
Database=my.interbasehost.net/3065?ssl=true?serverPublicFile=C:\PublicCertFileOnClient\CertFile.pem??:C:/DB/TEST.IB
User_Name=sysdba
Password=masterkey
CharacterSet=UTF8
ExtendedMetadata=True

For more details, see Chapter 5, starting with page 5, of the InterBase Operations Guide manual.

Other Usage Cases

  • Connect to a database running on a remote server via TCP/IP protocol:
DriverID=IB
Database=C:\ib\ADDEMO_IBXE3.gdb
Protocol=TCPIP
Server=IBSrv
User_Name=sysdba
Password=masterkey
CharacterSet=win1252
ExtendedMetadata=True
  • Connect to a database running on a remote server via TCP/IP protocol:
DriverID=IB
Database=IBSrv:C:\ib\ADDEMO_IBXE3.gdb
User_Name=sysdba
Password=masterkey
CharacterSet=utf8
  • Connect to a local database:
DriverID=IB
Database=C:\ib\ADDEMO_IBXE3.gdb
User_Name=sysdba
Password=masterkey
CharacterSet=win1251
  • Connect to an InterBase ToGo database:

Drop the TFDPhysIBDriverLink component to the form and set its VendorLib to <your path>\ibtogo.dll or use virtual driver definition.

DriverID=IB
Database=C:\ib\ADDEMO_IBXE3.gdb
User_Name=sysdba
Password=masterkey
CharacterSet=utf8
  • Connect to a database file in Documents folder on iOS Device:
DriverID=IB
User_Name=sysdba
Password=masterkey
Database=$(DOC)/ADDEMO.GDB
SQLDialect=3
CharacterSet=UTF8
ExtendedMetadata=True
  • Connect to an encrypted database file on the external storage on the Android device:
DriverID=IB
User_Name=sysdba
Password=masterkey
Database=$(DOC)/ADDEMO.GDB
SQLDialect=3
CharacterSet=UTF8
ExtendedMetadata=True
SEPassword=12345
  • Connect to an IBLite database:
DriverID=IBLite
Database=C:\ib\ADDEMO_IBXE3.gdb
User_Name=sysdba
Password=masterkey
CharacterSet=utf8

See Also

Samples