Object handling was re-written in PHP version 5, and from version 5 onwards, PHP also supports various OOP components, such as interfaces, abstract classes. There is one such interface named PHP Data Objects (PDO), which defines a lightweight abstraction layer to access databases from PHP. So, you can use the same methods and functions to query and fetch data from all databases that implement the PDO specification.

IBM provides two drivers, PDO_IBM and IBM_DB2, for you to access IBM DB2 databases.

4.4.1 PDO_IBM

PDO_IBM is an open source driver of PHP PDO specification implementation. This extension is supported on PHP release version 5.1 and greater. You can use PDO_IBM to connect to both cataloged and non-cataloged databases.

Through PDO_IBM, you can use DB2 features, such as issue SQL queries, call stored procedures, work with large objects, persistent connections, and prepared connections. As PDO is not present in versions lower than PHP version 5, use of IBM_DB2 is recommended. You can get more information about PDO_IBM at:

http://www.php.net/manual/en/ref.pdo-ibm.php

4.4.2 IBM_DB2

IBM_DB2 provides an interface to connect to IBM DB2 databases. This extension is supported on PHP releases version 4 and greater. You can use IBM_DB2 to connect to both cataloged and non-cataloged databases. In addition to providing methods to issue SQL queries, call stored procedures, work with large objects, persistent connections, and prepared connections; IBM_DB2 also provides functions for getting details about database client and server by querying the system catalog tables. For more information about IBM_DB2 functions, visit:

http://www.php.net/manual/en/ref.ibm-db2.php

Note: There is also an extension named PDO_INFORMIX to access Informix® databases. Further information can be found in the following URL:

http://www.php.net/manual/en/ref.pdo-informix.php

4.4.3 Installation of IBM PHP drivers

Installation procedure of both IBM_DB2 and PDO_IBM is similar. Hence, we discuss both simultaneously: first, the prerequisites to installing IBM PHP drivers, and then the installation process for Linux, UNIX, and Windows.

170DB2 Deployment Guide

Page 184
Image 184
IBM manual Pdoibm, IBMDB2, Installation of IBM PHP drivers, 170 DB2 Deployment Guide