Posts

Showing posts from July, 2009

iSeries Access ODBC for PHP Linux

I set up a Centos 5.2 server with PHP 5.1.6 and wanted to allow access to a AS/400 DB2 database. First thing I did was download the iSeriesAccess driver called "iSeriesAccess-5.4.0-1.6.i386.rpm". This is also used to run a 5250/Terminal session to an AS/400, but for the purposes of this, it installs an odbc driver in "/opt/ibm/iSeriesAccess/lib/" using "libcwbodbc.so" and "libcwbodbcs.so". Then I created a php test page to connect to the AS/400. After a days worth of trial and failure, the best advice I could find on the internet was from the phpbuilder site here . Here's my final working example (php code): < ? php $driver = '{iSeries Access ODBC Driver}'; $system = 'as400.company.com'; $dsn = "DRIVER=$driver;SYSTEM=$system"; $name = 'user'; $pw = 'passw0rd'; echo "Connecting to AS/400..."; $con = odbc_connect($dsn,$name,$pw); if (!$con) { echo 'E