1
votes

I am trying to establish a connection between a linux server and our AS400 to query the DB2 database. I installed and configured both unixODBC and the iSeries Access drivers. When using isql with a DSN specified in /etc/odbc.ini the connection goes through fine. When I run php -f connect.php the connection works as well, but when I browse to http://localhost/connect.php i get the following message:

exception 'PDOException' with message 'SQLSTATE[01000] SQLDriverConnect: 0 [unixODBC][Driver Manager]Can't open lib '/opt/ibm/iSeriesAccess/lib64/libcwbodbc.so' : file not found' in /srv/http/connect.php:25 Stack trace: #0 /srv/http/connect.php(25): PDO->__construct('odbc:DRIVER={iS...', '', '') #1 {main}

I am assuming it must be a permission issue... But I am not sure how to go about it. Any ideas? Thank you.

1
Ok after reading a bunch of posts online I'm starting to see the misunderstanding here... when the php page says "can't open lib '/opt/ibm/etc...' it assumes the path is in /srv/http/opt/ibm/etc...' rather than starting from the root... The issue is that the path is provided by the file odbcinst.ini and read as is...Tony Morello

1 Answers

1
votes

OK, I found the solution and I'll post it for anyone who needs it.

Creating a symbolic link to the driver files in /usr/lib/ solves the issue.

sudo ln -s /opt/ibm/iSeriesAccess/lib64/* /usr/lib/*

After that Apache/PHP will be able to locate the file without hiccups.

Hope it helps.