iSeries Access for Linux ODBC Driver & PHP support

Comments Off on iSeries Access for Linux ODBC Driver & PHP support

December 14, 2015 by globz

This is a short guide on how to install the ODBC driver for iSeries Access on Ubuntu 64 bits. I will first let you know that the hardest part about this whole process isn’t the actual installation & configuration, no…this is just a cake walk, the real deal is all about finding and downloading the damn driver!

IBM is a real pain in the ass when it comes to validating your access level so you can actually download anything from the entitled software page. You will need your machine type number, machine serial number, IBM customer number and probably another proof just to download the driver! All in all this should take you a couple hours/days depending on how fast you can get this information, if you ever get in a situation where you cannot validate all of this information with IBM please send me an email.

Ok! step #1 is now over, you successfully downloaded the driver BUT wait there’s more… in my case I received an RPM package instead of debian this is all we could find at the time so here’s how to proceed with the installation.

(please note that if you already have a debian package you can skip this step)

iSeriesAccess-7.1.0-1.0.x86_64.rpm — this is the package I will be using.

convert the rpm package with the following command :

alien -d -c -k -v iSeriesAccess-7.1.0-1.0.x86_64.rpm

-d debian
-c this is important, this will convert the scripts that create the symlinks
-k not so important, just to keep the version of the rpm in the .deb
-v verbosity, if you wanna know what’s up!

Ok, now alien should spit out a shiny debian package just for you!

iseriesaccess_7.1.0-1.0_amd64.deb

step #2 yay! Prerequisite & installation time!

Run these commands as root :
-first, we must install php5-odbc module
-second, we must install unixodbc
-third, Ubuntu does not include en_US locale by default and it is needed by the emulator
-forth, install your debian package

apt-get install php5-odbc	
apt-get install unixodbc
locale-gen en_US 
dpkg -i iseriesaccess_7.1.0-1.0_amd64.deb

This should go smooth with some symlink errors related to libraries but we are taking care of this with our next step.

now step #3!

symbolic link the libraries to the /usr/lib folder

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

Now that everything is setup correctly we can proceed with the configuration process…step #4!

edit /etc/odbcinst.ini :

[iSeries Access ODBC Driver]
Description = iSeries Access for Linux ODBC Driver
Driver = /opt/ibm/iSeriesAccess/lib64/libcwbodbc.so
Setup = /opt/ibm/iSeriesAccess/lib64/libcwbodbcs.so
NOTE1 = If using unixODBC 2.2.11 or later and you want the 32 and 64-bit ODBC drivers to share DSN's,
NOTE2 = the following Driver64/Setup64 keywords will provide that support.
Driver64 = /opt/ibm/iSeriesAccess/lib64/libcwbodbc.so
Setup64 = /opt/ibm/iSeriesAccess/lib64/libcwbodbcs.so
Threading = 2
DontDLClose = 1
UsageCount = 1

[iSeries Access ODBC Driver 64-bit]
Description = iSeries Access for Linux 64-bit ODBC Driver
Driver = /opt/ibm/iSeriesAccess/lib64/libcwbodbc.so
Setup = /opt/ibm/iSeriesAccess/lib64/libcwbodbcs.so
Threading = 0
DontDLClose = 1
UsageCount = 4

edit /etc/odbc.ini :

[ODBC Data Sources]
Your Data source = Your Data source


[iseries]
Description = iSeries Access ODBC Driver
Driver = iSeries Access ODBC Driver
System = Your AS400 IP/FQDN
UserID = USER
Password = PASSWORD
Naming = 1
DefaultLibraries = leave blank/specify here or inside your script/default is QGPL
Database = leave blank/specify here or inside your script 
ConnectionType = 2
CommitMode = 2
ExtendedDynamic = 1
DefaultPkgLibrary = leave blank/specify here or inside your script
DefaultPackage = A/DEFAULT(IBM),2,0,1,0,512
AllowDataCompression = 1
LibraryView = 0
AllowUnsupportedChar = 1
ForceTranslation = 1
Trace = 0

Your final step has now arrived…test your connection!!

(I am using the data source name “iseries” in this example)

isql

You now have a working ODBC connection to your iseries which you can use via DSN and inside your own application.


Comments Off on iSeries Access for Linux ODBC Driver & PHP support

Sorry, comments are closed.