Query: pdo_ibm-dsn
OS: php
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
PDO_IBM-DSN(3) 1 PDO_IBM-DSN(3) PDO_IBM DSN - Connecting to IBM databases The PDO_IBM Data Source Name (DSN) is based on the IBM CLI DSN. The major components of the PDO_IBM DSN are: o DSN prefix - The DSN prefix is ibm:. o DSN - The DSN can be any of the following: o a) Data source setup using db2cli.ini or odbc.ini o b) Catalogued database name i.e. database alias in the DB2 client catalog o 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 fol- lowing values: o $database - The name of the database. o $hostname - The hostname or IP address of the database server. o $port - The TCP/IP port on which the database is listening for requests. o $username - The username with which you are connecting to the database. o $password - The password with which you are connecting to the database. Example #1 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: $db = new PDO("ibm:DSN=DB2_9", "", ""); [DB2_9] Database=testdb Protocol=tcpip Hostname=11.22.33.444 Servicename=56789 Example #2 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 syn- tax. $db = new PDO("ibm:DRIVER={IBM DB2 ODBC DRIVER};DATABASE=testdb;" . "HOSTNAME=11.22.33.444;PORT=56789;PROTOCOL=TCPIP;", "testuser", "tespass"); PHP Documentation Group PDO_IBM-DSN(3)