Php – ODBC Connection with IBM DB2 using PHP 5.1.6

db2ibm-midrangeodbcPHPunixodbc

I'm using CentOS release 5.6 (Final) with PHP 5.1.6 (cli) (built: Feb 2 2012 18:24:47).
I need to connect with a DB2 database server in same local network.
Db2 version is V5R3.
I have installed iSeriesAccess client as well as unixODBC.

My odbc.ini configuration:

[iSeries Access ODBC Driver]
Description             = iSeries Access for Linux ODBC Driver
Driver          = /opt/ibm/iSeriesAccess/lib/libcwbodbc.so
Setup           = /opt/ibm/iSeriesAccess/lib/libcwbodbcs.so
NOTE1           = If using unixODBC 2.2.11 or later and you want the 32 and 64-bit ODBC drivers to share DSN's,
NOTE2           = the following Driver64/Setup64 keywords will provide that support.
Driver64                = /opt/ibm/iSeriesAccess/lib64/libcwbodbc.so
Setup64         = /opt/ibm/iSeriesAccess/lib64/libcwbodbcs.so
Threading               = 2
DontDLClose             = 1

UsageCount              = 1

i'm running the following code:

<?php
$database = 'dbname';
$server = 'local_ip';
$user = 'username';
$password = 'password';
$driver = 'iSeries Access ODBC Driver';



$conn = odbc_connect("Driver={iSeries Access ODBC Driver};Server=$server;Database=$database;", $user, $password);
if (!$conn......)

I'm getting the following error message:
"[unixODBC][IBM][System i Access ODBC Driver]Missing system name needed for connection.Error!"

Is there anything I'm missing? your suggestions are welcome.

Best Answer

The Server property should be System.

More information can be found in the i5/OS Information Center for Connection string keywords and General properties.