I Access
Tier2.IAccess History
Hide minor edits - Show changes to markup
ODBC connect to IBM i
ODBC connect to IBM i
Platforms
Driver is available for the following platforms:
- Windows
- IBM i Access for Windows 7.1
- IBM i Access Client Solutions - Windows Application Package
- Linux
- IBM i Access Client Solutions - Linux Application Package
Installation
- Windows
For IBM i Access for Windows, run the exe for your platform (64-bit/32-bit)
For the Windows Application Package:
- unzip the zip file and run the exe for you
- cd to Image64a or Image32, depending on whether you’re on 64-bit or 32-bit Windows
- run the setup.exe
- Linux
Packaged as zip file like IBMiAccess_v1r1_LinuxAP.zip Zip file contains rpm and debs for various architectures: i386, x86_64, ppc, ppc64, ppc64le
If on rpm-based distro (RHEL, SLES, CentOS, Fedora, openSUSE, …) install the rpm using your package manager:
eg. zypper in ibm-iaccess-1.1.0.3-1.0.x86_64.rpm
eg. yum install ibm-iaccess-1.1.0.3-1.0.x86_64.rpm
Or rpm, but you’ll need to dependency resolution yourself…rpm -ihv ibm-iaccess-1.1.0.3-1.0.x86_64.rpm
If on deb-based distro (Debian, Ubuntu, Mint, …) install the deb (NOTE: debs only currently built for Intel/x86 not POWER) dpkg -i ibm-iaccess-1.1.0.3-1.0.amd64.deb
Run apt-get to install any dependencies and finish configuring things apt-get install -f
Additionally, there are 32bit packages that can be co-installed with the 64-bit packages to enable both 32-bit and 64-bit applications to use the driver. These are suffixed with −32bit on the name
eg. ibm-iaccess-1.1.0.3-1.0.x86_64.rpm
Configuration
On both Windows and Linux, the driver is registered with the Driver Manager automatically during installation. On Linux, it may not be installed if odbcinst is not found.
To fix, run the following command: odbcinst -i -d -f /opt/ibm/iaccess/unixodbcregistration
Creating a DSN
On Windows you can use ODBC Data Source Administrator in the Administrative Tools folder of the Control Panel
On Linux, you can create a DSN using the ODBCConfig GUI if your distribution still has it or edit the configuration files manually
First, run odbcinst -j
to show where your paths are:
Linux instructions (similar for Windows):
Q How do i setup my odbc connection?
edit the /etc odbc files
Tip: On my Linux machine I copied CA drivers to /usr/lib avoiding “LD_LIBRARY_PATH” (do this) … > sudo cp /opt/ibm/iSeriesAccess/lib/* /usr/lib/.
>sudo gedit /etc/odbcinst.ini [iSeries Access ODBC Driver] Description = iSeries Access for Linux ODBC Driver Driver = /usr/lib/libcwbodbc.so Driver64 = Setup = /usr/lib/libcwbodbc.so Setup64 = UsageCount = CPTimeout = CPReuse = Threading = 2 >sudo gedit /etc/odbc.ini [myibmi] Description = iSeries os400 Driver = iSeries Access ODBC Driver System = myibmi.somewhere.com
Q How do I test my odbc connection?
use odbc tool isql >isql myibmi MYID MYPASSWORD
Q how do i use with PHP
download the pear test cases and study odbc
kadler@kadler:~$ odbcinst -j unixODBC 2.2.14 DRIVERS…………: /etc/odbcinst.ini SYSTEM DATA SOURCES: /etc/odbc.ini FILE DATA SOURCES..: /etc/ODBCDataSources USER DATA SOURCES..: /home/kadler/.odbc.ini SQLULEN Size…….: 8 SQLLEN Size……..: 8 SQLSETPOSIROW Size.: 8
Linux ODBC may already run, but …
Linux distributions often include a default ODBC driver already configured (see check below), however as you use these “out of the box” Linux ODBC drivers you may find they fall short of IBM i specific needs (or you see issues). Therefore you may want to avoid headaches by starting with ODBC drivers from iAccess product (build by IBM i folks at Rochester). This page gives you an idea what you need to get started with iAccess ODBC.
Linux true 64 bit ODBC manager may have trouble running iAccess 64 for Linux. For most 64-bit platforms, you can also install the 32-bit version. Whichever one you install, the last one installed will become the default ODBC driver. See the unixODBC configuration file, odbcinst.ini, for more information. iAccess 64 issue
Check your odbc configuration
Walk before we run … check if client access ODBC is working from command line.
On this system, system-wide DSNs go in /etc/odbc.ini and user-only DSNs go in $HOME/.odbc.ini
The most minimal configuration needed is:
Q How do I test my odbc connection?
use odbc tool isql >isql myibmi MYID MYPASSWORD
[<dsn>] Driver = IBM i Access ODBC Driver System = <system hostname>
For a list of DSN options, see this section of the Knowledge Center
Verifying configuration
On Linux you can verify using isql or iusql:
isql <dsn> <username> <password>
$conn = odbc_connect(“myibmi”,”MYUID”,”MYPWD”);
$conn = odbc_connect(“<dsn>”,”<username>”,”<password>”);
odbc configuration (if you need help)
Your configuration probably already works, but for those that need Linux instructions …
First go get odbc iAccess drivers at this link … {iAccess ODBC Drivers}. When installing iAccess on my Linux machine I copied IBM CA drivers to /usr/lib avoiding “LD_LIBRARY_PATH” (do this please to save hours of fustration) …
> sudo cp /opt/ibm/iSeriesAccess/lib/* /usr/lib/.
Q: How do i setup my odbc connection? A: edit the /etc odbc files 1) drivers ... >sudo gedit /etc/odbcinst.ini [iSeries Access ODBC Driver] Description = iSeries Access for Linux ODBC Driver Driver = /usr/lib/libcwbodbc.so Driver64 = Setup = /usr/lib/libcwbodbc.so Setup64 = UsageCount = CPTimeout = CPReuse = Threading = 2 2) names of IBM i machines (myibmi) ... >sudo gedit /etc/odbc.ini [myibmi] Description = iSeries os400 Driver = iSeries Access ODBC Driver System = myibmi.somewhere.com
64bit
Note: If 64-bit Linux use Driver64/Setup64, but you need to run a 64bit Zend Server. Also, If you have a 64-bit Linux machine copy the /opt/ibm/iSeriesAccess/lib64/* drivers. oh, crikey! Windows/WOW64, same rule applies Zend Server 32bit (no Windows Zend Server 64bit available), ... my Windows 64bit telly is on the fritz again, but i think the second one (Wow6432Node): reg query "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI" reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ODBC\ODBCINST.INI"
Install PHP on your PC/laptop
Step 1) Download Zend Server …
- {Zend Download site} - Zend Server Community Edition
- … click download for your laptop (Linux, Mac, Windows)
- Install Zend Server on your laptop
- php-x.x-extra-extensions-zend-server — Linux install extra to run odbc
- Administration
- {getting started}
64-bit Considerations for Linux
- If you’re using pdo_odbc prior to PHP 5.6, there is a bug that will cause random crashes
- If you’re using the old iSeriesAccess rpm you will have problems:
- ODBC driver links against older odbcinst.so.1, causing rpm dependency errors
- Not fully 64-bit compliant (32-bit SQLLEN parameters) causing random crashes when using modern unixODBC
- Hasn’t been updated in years, many fixes and improvements missing
- No Debian/Ubuntu support
Tony “Ranger” Cairns - IBM i PHP / PASE
Tony “Ranger” Cairns - IBM i PHP / PASE
Kevin Adler - IBM i PASE / DB2 / ODBC