Wednesday, November 18, 2009

Configure DBD::ODBC on AIX 5.3

DBD::ODBC perl module helps connecting to various datasources using ODBC. In order to get this module working, one needs to install unixodbc on aix platform.

1.Download unixODBC-2.2.11
- Version 2.2.14 has some issues causing installation to fail.
2.
export CC=xlc_r
export CCC=xlC_r

3. For 64 bit OS
export OBJECT_MODE=64
export CFLAGS=-q64

It is possible to install 32 bit binaries on 64 bit OS. Just do not set the above two variables.

4 Execute configure
./configure --prefix=/opt/unixODBC --disable-gui CC=xlc_r CXX=xlC_r
make
make install

5. Generate shared object libraries (/opt/unixODBC/lib)
ar -x libodbc.a
ar -x libodbcinst.a
ar -x libodbccr.a

5. Set the following environment variables

export ODBCINI=/usr/scratch/odbc.ini
export ODBCHOME=/opt/unixODBC
export LIBPATH=/opt/unixODBC/lib:${LIBPATH}


If perl is already installed, install module DBI and then DBD::ODBC. For new install follow the procedure mentioned below:

1. Download perl 5.10.1

2 If OS is 64 bit use flag -Duse64bitall
sh Configure -Duse64bitall -Dprefix=/opt/perl -des
make
make install

To install 32 bit perl binaries, do not use flag -Duse64bitall

3. Configure CPAN. First configure it in default mode. Then make changes to the proxy settings
cpan> o conf init /proxy/
--specify ftp_proxy and http_proxy to be used
cpan> 0 conf commit

4. Install DBI module
cpan> install DBI

5. install DBD::ODBC
cpan> install DBD::ODBC

you should be all set to use perl DBD::ODBC module !!!