I can't get PHP to connect to DB2 on the same server.
I'm running both Apache/PHP and DB2 on Mandrake Linux 9.2. I didn't compile
PHP; just installed what appear to be the appropriate RPMs (I don't like to
compile/install and ruin RPM dependencies; I've seen the documents which say to
build PHP "--with-ibm-db2=/home/db2inst1/sqllib"):
unixODBC-2.2.6-4mdk
libunixODBC2-2.2.6-4mdk
php-mysql-4.3.2-3mdk
libphp_common43 2-4.3.3-2mdk
php-ini-4.3.3-1mdk
php-xml-4.3.2-3mdk
php-cli-4.3.3-2mdk
unixODBC-gui-gtk-2.2.6-4mdk
php-cgi-4.3.3-2mdk
php-xmlrpc-4.3.2-3mdk
php-pgsql-4.3.2-5mdk
php-imap-4.3.2-3mdk
php-unixODBC-4.3.3-1mdk
unixODBC-gui-qt-2.2.6-4mdk
php-pear-4.3.2-3mdk
php-ldap-4.3.2-3mdk
apache2-mod_php-2.0.47_4.3.2-2mdk
php-xslt-4.3.2-3mdk
libgtkodbcconfi g0-2.2.6-4mdk
I can't find a Mandrake RPM for php-db2 nor php-ibm-db2.
I've found documentation at:
http://www-1.ibm.com/support/docview...&cc=US&lang=en
http://www-1.ibm.com/support/docview...&cc=US&lang=en
http://publib.boulder.ibm.com/infoce...d/t0006349.htm
http://www.unixodbc.org/odbcinst.html
Some of these appear to conflict, particularly the latter two.
I've tried the methods in both the third and fourth URLs.
No matter what combination of *odbc*.ini files I've tried, I always get:
IM004: [unixODBC][Driver Manager]Driver's SQLAllocHandle on SQL_HANDLE_HENV failed
Here are the /etc/odbc.ini and /etc/odbcinst.ini, and /home/db2inst1/.odbc.ini
for this situation:
odbc.ini:
[ODBC Data Source]
mindmeld=IBM DB2 ODBC DRIVER
[mindmeld]
Driver=db2
Description=DB2 Mindmeld DB
Trace=Yes
Tracefile=/tmp/sql.log
Port=3700
Database=mindme ld
odbcinst.ini:
[PostgreSQL]
Description = ODBC for PostgreSQL
Driver = /usr/lib/libodbcpsql.so
Setup = /usr/lib/libodbcpsqlS.so
FileUsage = 1
[db2]
Description = IBM DB2 ODBC DRIVERR
Driver = /var/opt/IBM/db2/V8.1/lib/libdb2.so
FileUsage = 1
/home/db2inst1/.odbc.ini:
[ODBC Data Source]
mindmeld=IBM DB2 ODBC DRIVER
[mindmeld]
Driver=/var/opt/IBM/db2/V8.1/lib/libdb2.so
Description=db2 mindmeld database
Database=mindme ld
The PHP call to connect I'm using is:
odbc_connect("m indmeld","db2in st1","<the right password>");
The db2inst1 user is able to successfully:
db2 connect to mindmeld user db2inst1 using <the right password>
Thanks in advance,
Rick