IBM Functions (PDO_IBM)IBM (PDO)
&reftitle.intro;
PDO_IBM is a driver that implements the PHP Data
Objects (PDO) interface to enable access from PHP to IBM databases.
&reference.pdo-ibm.configure;
PDO_IBM DSNConnecting to IBM databases
&reftitle.description;
The PDO_IBM Data Source Name (DSN) is based on the IBM CLI DSN. The major
components of the PDO_IBM DSN are:
DSN prefix
The DSN prefix is ibm:.
DSN
The DSN can be any of the following:
a) Data source setup using db2cli.ini
or odbc.ini
b) Catalogued database name i.e. database alias in the DB2 client
catalog
c) Complete connection string in the following format:
DRIVER={IBM DB2 ODBC DRIVER};DATABASE=database;HOSTNAME=hostname;PORT=port;PROTOCOL=TCPIP;UID=username;PWD=password;
where the parameters represent the following values:
database
The name of the database.
hostname
The hostname or IP address of the database server.
port
The TCP/IP port on which the database is listening for
requests.
username
The username with which you are connecting to the
database.
password
The password with which you are connecting to the database.
&reftitle.examples;
PDO_IBM DSN example using db2cli.ini
The following example shows a PDO_IBM DSN for connecting to an DB2
database cataloged as DB2_9 in db2cli.ini:
PDO_IBM DSN example using a connection string
The following example shows a PDO_IBM DSN for connecting to an DB2
database named testdb using the DB2 CLI
connection string syntax.