Thursday, June 5, 2014

PHP connect IBM db2 database in XAMPP

php_ibm_db2.dll is needed for PHP db2_connect function to connect to IBM db2 database.
1) Go to (for Windows)
2) Click PHP 5.4._
Latest xampp is PHP5.5, but latest php_ibm_db2.dll is for PHP5.4
I have to install two version of XAMPP, one is PHP5.5, another PHP5.4 for php_ibm_db2.dll
3) Download
and unzip
4) Copy php_ibm_db2.dll to php/ext/ directory
5) In php.ini, add
6)Restart Apache in XAMPP
7) My PHP test code to connect to IBM db2 database, replace to your database name, user name and password
//db2 express c  (v10.5) in local
$database = "SAMPLE";
$user = "db2admin";
$password = "admin123";

$conn = db2_connect($database, $user, $password);

if ($conn) {
echo "Connection succeeded.";
else {
echo "Connection failed.";

For Linux:
Video: PHP connect IBM db2 database in XAMPP

No comments:

Post a Comment