I am trying to get php on Linux Centos server access as/400 (iSeries) db2 database.
I am using this IBM guide as much as possible, (though we could not get GUI configuration utility working.)
http://www-03.ibm.com/systems/i/soft...ide/index.html
I downloaded and successfully installed iSeriesAccess drivers and pre-requisites.
rpm -i iSeriesAccess-5.4.0-1.6.i386.rpm
I have configured these files to define drivers/DNS:
/etc/odbc.ini and /etc/odbcinst.ini
[iSeries Access ODBC Driver]
Description = iSeries Access for Linux ODBC Driver
Driver = /opt/ibm/iSeriesAccess/lib/libcwbodbc.so
Setup = /opt/ibm/iSeriesAccess/lib/libcwbodbcs.so
Driver64 = /opt/ibm/iSeriesAccess/lib64/libcwbodbc.so
Setup64 = /opt/ibm/iSeriesAccess/lib64/libcwbodbcs.so
Threading = 2
DontDLClose = 1
UsageCount = 1
file /etc/odbc.ini was empty so I added this configuration:
[AS400]
Description = iSeries Access ODBC Driver
Driver = iSeries Access ODBC Driver
System = 172.999.999.999 (from netstat option 1)
UserID = my_user
Password = my_pass
Naming = 0
DefaultLibraries = QGPL
Database =
ConnectionType = 0
CommitMode = 2
ExtendedDynamic = 1
DefaultPkgLibrary = QGPL
DefaultPackage = A/DEFAULT(IBM),2,0,1,0,512
AllowDataCompression = 1
LibraryView = 0
AllowUnsupportedChar = 0
ForceTranslation = 0
Trace = 1
DSN = AS400
I assume these are working because I can run
isql -v AS400
and I connect successfully to db2 database can perform queries from Linux box.
However I have been unable to get make and ODBC connection in PHP on the Linux box.
Is there another way to test DSN from php? or get more detailed error information?
$server="172.999.999.999";
// tried with both system name and "AS400", the dsn name
$user="my_user";
$pass="my_pass";
$conn=odbc_connect($server,$user,$pass);
if ($conn == false) {
echo "Not able to connect to database...
";
}
result:
**Not able to connect to database...**
phpinfo() shows that php was compiled with unixODBC and unixODBC is enabled.
any help is appreciated!
See Question&Answers more detail:
os