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:
dbexppge.dll
(libdbexppge.so on Linux/Kylix) to a folder in your path. 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.libpq.dll (libpq.so on Linux) file to a dir on your PATH. Please try to use the libpq supplied with the distribution. If you're
under Linux, the standard
libpq.so from the PostgreSQL original installation should work.
libpq
incompatibilities:libpq.dll /libpq.so library provided in the distribution and
other clients such as psql -
specialy under Linux/Kylix. To solve this, you can either:
If you rename the library to libpq_pge.so, for instance, your entry should
become VendorLib=libpq_pge.so accordingly.
There are more instructions on the dbxdrivers.ini/dbxdrivers file below.
Linux only)- use the
standard libpq.so file from the
original PostgreSQL
distribution, as it is, on your system;libpq.so/libpq.dll file from the pgExpress Driver distribution to something
else, and update the entry on the dbxdrivers.ini /dbxdrivers file (which is by default
VendorLib=libpq.sounder Kylix or
VendorLib=libpq.dllunder
Windows.$ProgramFiles\Common Files\Borland
Shared\DBExpress folder. The changes to be applied are the
following:
dbxdrivers.ini file. On
Kylix™, this file is called
dbxdrivers. On the [Installed Drivers] section, add the
PostgreSQL=1 key and value:
[Installed Drivers]
DB2=1
Interbase=1
MYSQL=1
Oracle=1
PostgreSQL=1
[PostgreSQL] section:
[Oracle]
GetDriverFunc=getSQLDriverORACLE
LibraryName=dbexpora.dll
VendorLib=OCI.DLL
BlobSize=-1
DataBase=Database Name
ErrorResourceFile=
LocaleCode=0000
Password=password
Oracle TransIsolation=ReadCommited
User_Name=user
[PostgreSQL]
GetDriverFunc=getSQLDriverPOSTGRESQL
LibraryName=dbexppge.dll
VendorLib=LIBPQ.DLL
On Kylix, the PostgreSQL
section is slightly different to reflect the Linux library file names:
[PostgreSQL] GetDriverFunc=getSQLDriverPOSTGRESQL LibraryName=libdbexppge.so VendorLib=libpq.so
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):
LD_LIBRARY_PATH=/home/steve/lib/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:
[PGEConnection] BlobSize=32 HostName=host Database=database_name DriverName=PostgreSQL Password=temp123 User_Name=steve
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):
[PGEConnection] DriverName=PostgreSQL Database=hostname/database_name User_Name=steve Password=temp123
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
property to TSQLConnection.LoadParamsOnConnectTrue. 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:port/database
Where:
Hostname (DNS or
IP) of the machine. If you don't supply this parameter, it defaults
to localhost.:').Database = myserver.mydomain.com/database Database = myserver.mydomain.com:5432/database Database = 111.111.111.111:5432/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:
[PGEConnection] DriverName=PostgreSQL Database=hostname1/database_name User_Name=steve Password=temp123
[pgserver] DriverName=PostgreSQL Database=pgserver/database_name User_Name=john
That's it; the driver should be working now.
dbxdrivers(.ini) and dbxconnections(.ini) for both Delphi and Kylix.