PHPDB 2 Compile

Goto Main Page
Goto PHP page
Goto Documents

==================
compile IBM i PASE
==================
0) Most use gcc compiler (download http://www.youngiprofessionals.com/wiki/index.php/PASE/GCC ) 
1) Copy SQ headers
zzcopyincludes.sh:
#!/QOpenSys/usr/bin/ksh
ls /QIBM/include/sql* > ./list2
for i in $(< ./list2)
do
  echo "PREPARATION COPY"
  system -v "CPY OBJ('$i') TODIR('/usr/include/') TOCCSID(*STDASCII) DTAFMT(*TEXT) REPLACE(*YES)"                                      
done 
2) Create sqlcli1.h to match LUW compiles
/usr/include/sqlcli1.h 
#ifndef SQL_H_SQLCLI1
#include "sqlcli.h";
#endif
3) common symbolic links
ln -sf /QOpenSys/opt/freeware/bin /usr/local/bin
ln -sf /QOpenSys/opt/freeware/lib /usr/local/lib
4) make a copy
cp /usr/local/zendsvr/lib/php_extensions/ibm_db2.so /usr/local/zendsvr/lib/php_extensions/ibm_db2.so-orig

5) create binary
ssh -X lp0364d
bash
cd /home/ibm_db2-1.9.6
./zzallzs5.sh           (zend server 5)
./zzallzs6.sh           (zend server 6)

-- or --

ssh -X lp0364d
bash
cd /home/ibm_db2-1.9.6
export IBM_DB_HOME=/usr
export PHP_HOME=/usr/local/zendsvr
export PASE_TOOLS_HOME=/QOpenSys/usr
export AIX_TOOLS_HOME=/usr/local
export PATH=$PHP_HOME/bin:$PASE_TOOLS_HOME/bin:$AIX_TOOLS_HOME/bin:$PATH
export LIBPATH=$PHP_HOME/lib:$PASE_TOOLS_HOME/lib:$AIX_TOOLS_HOME/lib
export CC=gcc
export CFLAGS="-DPASE -I=.:$PHP_HOME/php/include"
export CCHOST=powerpc-ibm-aix6.1.0.0

php -v
gcc -v
  Target: powerpc-ibm-aix6.1.0.0 ... used in CCHOST above
tar -xf ibm_db2-1.9.6.tar
cd ibm_db2-1.9.6
phpize
./configure --build=$CCHOST --host=$CCHOST --target=$CCHOST
make
make install

================
compile linux (for IBM i people)
================
export IBM_DB_HOME=/home/db2inst2/sqllib
export PHP_HOME=/usr/local/zend
export PATH=$PHP_HOME/bin:$PATH
export CFLAGS=-I=.:$PHP_HOME/php/include
export LDFLAGS=-Wl,-rpath,$IBM_DB_HOME/lib
phpize
./configure
make
sudo make install

enable ibm_db2 connection to IBM i
----------------------------------
sudo e /home/db2inst1/sqllib/cfg/db2cli.ini &
; Comment lines start with a semi-colon.
; Database name can be found WRKRDBDIRE
[LP0364D]
Database=LP0364D
Protocol=tcpip
Hostname=lp0364d.rch.stglabs.ibm.com
Servicename=446
SchemaList=”*USRLIBL”

enable ibm_db2 load php:
------------------------
etc/config.d/ibm_db2.ini
extension=ibm_db2.so

check ibm_db2 loads ok:
-----------------------
php -i | grep -i db2

configure for IBM i
-------------------

run tests
---------
cd tests
e connection.inc (see db2cli.ini)
$database = 'LP0364D';
$user = 'DB2';
$password = 'MYPWD';

php test_001_ConnDb.phpt   ... try connection 1st
pear run-tests *.phpt      ... run all tests


===============
db2 connect remote
===============
First, you need a license installed, not free (see other wiki pages).

Quick DB2 Connect (see other wiki pages) ...
========
db2 connect 10.5+
db2inst2 -> linux install db2 connect instance
lp0364d -> IBM i
========

>su db2inst2
>db2
db2 => catalog tcpip node LP0364D remote lp0364d.rch.stglabs.ibm.com 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