By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,889 Members | 1,044 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,889 IT Pros & Developers. It's quick & easy.

PHP 5 with DB2 v9.5

P: n/a
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. Id like to get my
existing PHP code to work on the new server but Im not sure exactly
what steps to take and if itll 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/infoce.../t0011926.html

Thoughts?
Oct 17 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Fri, 17 Oct 2008 21:00:41 +0200, ch***************@gmail.com
<ch***************@gmail.comwrote:
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/infoce.../t0011926.html

Thoughts?
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
Oct 21 '08 #2

P: n/a
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
Oct 22 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.