2. Installation

The pgExpress Driver PostgreSQL dbExpress Driver installation procedure is similar to any other dbExpress driver's installation.

If you want to install the Delphi version, the files are under the pgExpress installation's Delphi directory; for the Kylix files, the directory is Kylix'.

If you're using the installer version (*.exe), it can perform the operations below for you, except configuring your connections parameters (what you can do manually by editing that file or just double-clicking a TSQLConnection component). You can edit the default [PGEConnection] entry it creates. The steps for manual installation are:

  1. Copy the driver dbexppge.dll (libdbexppge.so on Linux/Kylix) to a folder in your path. If you are using the multilanguage and/or protocol 3.0 driver, the driver name on the package will be another, such as dbexpge30-ml.dll or libdbexppge.so. It's your choice to rename the file or use the corresponding name on the entry on the dbxconnections(.ini) file. The usual folder is $Delphi\bin on Windows (where $Delphi is the Delphi's installed folder), or $kylix/bin on Kylix, but as long as it's on your path, you can choose any other folder.
  2. Make sure the libpq.dll (libpq.so on Linux) file from your PostgreSQL distribution, alongside all it's dependencies into a dir on your PATH. Under Linux, usually installing the distribution's PostgreSQL or just correlated client libraries will do it. Check Section 1.1, “Libpq” for more details.
  3. Setup the entries on the dbxdrivers.ini and dbxconnections.ini dbExpress configuration files. These files are at the $ProgramFiles\Common Files\Borland Shared\DBExpress folder depending on your IDE version; please check your documentation on their default location if you don't find them.

    The changes to be applied are the following: Edit the dbxdrivers.ini file. On Kylix, this file is called dbxdrivers. On the [Installed Drivers] section, add the PostgreSQL=1 key and value:

    [Installed Drivers]

  4. Still on this file, add the [PostgreSQL] section:
    DataBase=Database Name
    Oracle TransIsolation=ReadCommited


    On Kylix, the PostgreSQL section is slightly different to reflect the Linux library file names:


    Still on Linux/Kylix, you must add your driver's path to the LD_LIBRARY_PATH environment variable (or copy the driver to your Kylix's bin subdirectory):

    export LD_LIBRARY_PATH

    Edit the dbxconnections.ini file. On Kylix, it's is called dbxconnections. This file lists all the dbExpress connections and it can contain as many entries for the pgExpress Driver as you might want add. We supply here an example connection, but you should modify it to meet your own settings (specially the server address, database name, user name and password) params:


    The only required parameters are Database, DriverName, UserName and Password if desired. You can use a more reduced form like the one below (you're encouraged to use it):


    The other parameters are optional (only those listed above are supported by the pgExpress Driver) and their meaning is that on dbExpress documentation. Pay special attention to the Database parameter. dbExpress only will load the HostName parameter if you set the TSQLConnection.LoadParamsOnConnect property to True. We at Vita Voom Software™ have used the following rules for the format of the Database parameter that avoid that confusion and also adds support for a Port parameter. It seems like an URL:



    • host is the Hostname (DNS or IP) of the machine. If you don't supply this parameter, it defaults to localhost.
    • port is the port to connect to, on the database server host. This do not need to be supplied, if you use the default port (5432). But if you do supply this parameter, you need also specify the host name, and separate the host and port with a colon (':').
    • Database is the database name to connect to. This parameter must be supplied.
    • The following are valid Database parameters:
      Database = myserver.mydomain.com/database
      Database = myserver.mydomain.com:5432/database
      Database =
      Database = database

      Note that if you supply both the HostName and Database parameters with embedded hostname (as show above), the Database parameter will prevail. Don't forget you can add as many sections to the dbxconnections file as you want, like this:


That's it; the driver should be working now.


  • The default location for the dbxdrivers(.ini) and dbxconnections(.ini) files vary from each distribution; for instance, on Kylix it is ~/.borland, on Delphi6 and 7 it is %CommonFiles%\Borland Shared\DBExpress, and on BDS 2006 it is %ProgramFiles%\Borland\BDS\4.0\dbExpress. Please refer to your IDE documentation for the exact location of those configuration files. Also, remember you can distribute them in the same directory your application is located; that should make distribution easier.
  • Inside the distribution there are example dbxdrivers(.ini) and dbxconnections(.ini) for both Delphi and Kylix.

2.1. dbExpress 4.0 (Delphi 2007+) support

The pgExpress Driver for protocol 3.0 is compatible with Delphi 2007+ which uses the version 4.0 of the dbExpress protocol. We are already in late development of a 4.0 version of our driver, but until there the current version of the driver can be used in compatibility mode by following the these instructions:

  • Use the protocol 3.0 driver (dbexppge30.dll)
  • Add the following additional strings to the [PostgreSQL] section of dbxdrivers(.ini):

  • Distribute the DBXCommonDriver110.bpl package with your application.

Upgrading to Delphi 2007+

When upgrading to Delphi 2007+, there are some issues that must be observed:

  • Delphi 2007 do not support TFMTBcdFields; therefore, the pgExpress Driver maps NUMERIC/DECIMAL types as TBcdFields. Historically, a TFMTBcdField had more precision then a TBcdField, so pgExpress used that type in the mapping. If you have fields statically defined as TFMTBcdField, they can produce runtime error messages when the driver returns them as being TBcdField. You'll need to change the static definitions to map the new type; that can be easily done by either removing and readding these fields or doing a search/replace on the .pas and .dfm files that contain "TFmtBcdField"; replace it with "TBcdField".
  • The driver will probably detect by itself it's running under dbExpress4.0, but you can for force it by using the DBX4Compatible special param.
  • There are some issues using the driver in compatibility mode; sometimes libpq.dll errors could be raised. We are working on a native dbExpress4 version that will overcome all issues and fully utilize the new dbExpress architecture.