From YiPs Wiki (i powered)


(click to open)

Quick Page Table of Contents


DB2 Connect access only …

Goto Main Page

Who is this page for?

Instructions designed for IBM i developer learning PHP starting from ground zero …


On IBM i …

On laptop …

Check your IBM i configuration


1) WRKRDBDIRE - find tcp connection
2) WRKTCPSTS - check *DDM is running
3) STRTCPSVR SERVER(*DDM) - start DDM if not running

1) WRKRDBDIRE - find tcp connection (example: *LOCAL is LP0264D)


WRKRDBDIRE *LOCAL name (LP0264D) may not match your tcp name ( If the names do not match use the short name in your connection and catalog db2_connect(“C1E0CD143″,”MYUID”,”MYPWD”). Using a serial number is REALLY annoying thing IBM i ships by default for *LOCAL, so almost everyone deletes serial number entry and changes *LOCAL to match TCP name (sigh, yes i changed mine).

I am using iASP for my Zend Server machine configuration (MYASP2), so db2_connect(“MYASP2″,”MYUID”,”MYPWD”) is a valid DB2 “independent/isolated” connection.

I also have other IBM i machines configured remote (LP0164D and LP0364D), so db2_connect(“LP0164D or LP0364D”,”MYUID”,”MYPWD”) is a valid DB2 “remote” connection.

2) WRKTCPSTS - check *DDM is running


3) If not running use STRTCPSVR SERVER(*DDM). Communication DRDA is port 446 (NOT 8471).

Configure DB2 Connect

DB2 Connect

1) db2licm -l - check your license
2) db2 catalog - catalog your IBM i machine

Have db2 utility??

1) Use the db2 command line (if included in download)
db2 connect 10.5+
db2inst2 -> linux install db2 connect instance
lp0364d -> IBM i

>su db2inst2
db2 => catalog tcpip node LP0364D remote server 446
db2 => catalog db LP0364D at node LP0364D authentication dcs
db2 => catalog dcs db LP0364D as LP0364D
db2 => terminate
Note: "LP0364D" - can be found using WRKRDBDIRE (local RDB name / database name)

ERROR: if you see SQL0805N  Package "NULLID.SYSSH000" was not found

>su db2inst2
$ db2
db2 => connect to lp0364d user db2 using xxxxx 
db2 => bind "/opt/ibm/db2/V10.5/bnd/@db2cli.lst" blocking all grant public
db2 => terminate
Note: On IBM i CRTLIB NULLID (if not exist, before bind)

Use db2 test your connection.
> db2 connect to LP0264D user myUid using myPassword

If db2 catalog fails, likely you need to install missing license.
> db2licm -l
> db2licm -a db2/license/license_filename

Not have db2 utility??

1) or packages without db2 utility
> edit /opt/ibm/cli/cfg/db2cli.ini

2) If db2 catalog fails (db2cli.ini), likely you need to install missing license.
> ls /opt/ibm/cli/license (wherever db2 installed)
> cd /opt/ibm/cli/license (wherever db2 installed)
> unzip  (licence zip file you purchased)

more DB2 Connect configuration (if you need help)

DB2 Connect instructions click here {Linux DB2 Connect}.

If db2 connect is working, there is a good chance that PHP ibm_db2 will be working.

$conn = db2_connect("LP0264D","MYUID","MYPWD");

Run to IBM i

On your laptop create these files for testing via Zend Studio (or Apache, or command line)..


Tony “Ranger” Cairns - IBM i PHP / PASE

Retrieved from
Page last modified on February 23, 2015, at 05:00 PM EST