Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

PHP 5 with DB2 v9.5

0 views
Skip to first unread message

christop...@gmail.com

unread,
Oct 17, 2008, 3:00:41 PM10/17/08
to
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.db2.luw.apdv.php.doc/doc/t0011926.html

Thoughts?

Rik Wasmus

unread,
Oct 21, 2008, 7:22:55 PM10/21/08
to

Since that would still require a rewrite, and you're on RedHat, did you
try:

yum install php-odbc

No idea wether it will link to DB2, but worth a try if it saves you a
rewrite.
--
Rik Wasmus

christop...@gmail.com

unread,
Oct 22, 2008, 11:20:58 AM10/22/08
to
Yeah I tried that 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


0 new messages