Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / DB2 Topics / October 2008

Tip: Looking for answers? Try searching our database.

PHP5 and DB2 9.5

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
christophergraber@gmail.com - 17 Oct 2008 18:35 GMT
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

Christian Welzel - 18 Oct 2008 08:51 GMT
> 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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.