469,140 Members | 1,386 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,140 developers. It's quick & easy.

Can't get stock Mandrake 9.2 PHP to connect

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_common432-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
libgtkodbcconfig0-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=mindmeld

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=mindmeld

The PHP call to connect I'm using is:

odbc_connect("mindmeld","db2inst1","<the right password>");

The db2inst1 user is able to successfully:
db2 connect to mindmeld user db2inst1 using <the right password>

Thanks in advance,

Rick

Nov 12 '05 #1
1 3497
I continued searching, and found http://www.unixodbc.com/doc/db2.html

Based on its info, I put into odbcinst.ini:
DontDLClose = 1

And the following line into my php script:
putenv("DB2INSTANCE=db2inst1");

I can now connect and return a result set. :-)

Rick

Rick Hickerson wrote:
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_common432-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
libgtkodbcconfig0-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=mindmeld

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=mindmeld

The PHP call to connect I'm using is:

odbc_connect("mindmeld","db2inst1","<the right password>");

The db2inst1 user is able to successfully:
db2 connect to mindmeld user db2inst1 using <the right password>

Thanks in advance,

Rick


Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by R.Marquez | last post: by
2 posts views Thread by baumann.Pan | last post: by
reply views Thread by GH | last post: by
10 posts views Thread by Rhino | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Mortomer39 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.