We have an older Suse linux server with DB2 v8.2 and PHP 4.4.2. The
PHP was configured --with-ibm_db2 and uses odbc_connect(),
odbc_exec(), odbc_fetch_row(), odbc_result().
We have a new Redhat (RHEL5) server with DB2 Workgroup Edition v9.5
installed, and PHP 5.1.6 already installed. I’d like to get my
existing PHP code to work on the new server but I’m not sure exactly
what steps to take and if it’ll work.
Reading this made me think I need to set up PHP from scratch, but it
has a PDO example not --with-ibm_db2.
http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/index.jsp?topic=/com.ibm.db
2.luw.apdv.php.doc/doc/t0011926.html
> We have an older Suse linux server with DB2 v8.2 and PHP 4.4.2. The
> PHP was configured --with-ibm_db2 and uses odbc_connect(),
> odbc_exec(), odbc_fetch_row(), odbc_result().
You are using the functions of php odbc driver, not the ones of
the ibm_db2 driver (its functions start with db2_*()).
So nothing should change if you update your php as long as you make
sure, the odbc driver is included into php.
At least i think so :)

Signature
MfG, Christian Welzel aka Gawain@Regenbogen
GPG-Key: http://www.camlann.de/key.asc
Fingerprint: 4F50 19BF 3346 36A6 CFA9 DBDC C268 6D24 70A1 AD15
christophergraber@gmail.com - 22 Oct 2008 16:52 GMT
I did yum install php-odbc and then after restarting Apache I had an
"odbc"
section in the page I created using phpinfo().
This section shows unixODBC as the library, not DB2 as my old SuSE
box
does.
New RedHat "odbc" section of phpinfo():
odbc
ODBC Support enabled
Active Persistent Links 0
Active Links 0
ODBC library unixODBC
ODBC_INCLUDE -I/usr/include
ODBC_LFLAGS -L/usr/lib
ODBC_LIBS -lodbc
Old SuSE "odbc" section of phpinfo():
odbc
ODBC Support enabled
Active Persistent Links 0
Active Links 0
ODBC library db2
ODBC_INCLUDE -I/db2inst1/sqllib/include
ODBC_LFLAGS -L/db2inst1/sqllib/lib
ODBC_LIBS -ldb2
I tried one of my pages that uses odbc_connect() in RedHat and it
failed. Here's the error:
[Wed Oct 22 08:15:12 2008] [error] [client 192.168.32.119] PHP
Warning: odbc_connect() [<a href='function.odbc-
connect'>function.odbc-connect</a>]: SQL error: [unixODBC][Driver
Manager]Data source name not found, and no default driver specified,
SQL state IM002 in SQLConnect in /var/www/html/include/login.php on
line 20, referer: http://192.168.32.24/include/login.php
I'm not sure how to get it to do "db2" odbc. Very confused! Any
ideas?
Chris