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. 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.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. Check also Section 1.1, “Libpq”.$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 True. We at Vita Voom
Software™ have used the following rules for the format
of the TSQLConnection
.LoadParamsOnConnectDatabase
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)
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.dbxdrivers(.ini)
and dbxconnections(.ini)
for both Delphi and Kylix.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:
Add the following additional strings to the [PostgreSQL] section
of dbxdrivers(.ini)
:
[PostgreSQL] DriverUnit=DBXDynalink DriverPackageLoader=TDBXDynalinkDriverLoader DriverPackage=DBXCommonDriver110.bpl
DBXCommonDriver110.bpl
package with your
application.When upgrading to Delphi 2007+, there are some issues that must be observed: