Overview
This article is part of a series. See Using SAS/ACCESS Interface to ODBC on UNIX Platforms for a listing of all articles in this series.
Requirements
To use SAS/ACCESS Interface to ODBC on UNIX platforms, you must have one or more 64-bit ODBC drivers for the data sources to which you need to connect and an ODBC driver manager. In most cases, you can use a single ODBC driver manager with multiple ODBC drivers. Unless you license ODBC drivers from such vendors as DataDirect, the ODBC drivers that you obtain do not include an ODBC driver manager. You typically pair these drivers with a freeware unixODBC driver manager.
Process
Here are the steps to obtain and build this driver manager for AIX.
Use FTP in binary mode to move this file to your UNIX box. Place the file in the directory of your choice. This directory is used only during installation. For example, you might create a directory named unixODBC_download for this file.
By default, the unixODBC driver manager is installed in a particular directory such as /usr/local/lib on AIX. Because this directory likely already contains many other third-party components, this can make it difficult to identify unixODBC-specific components. If other ODBC client components are already installed in the default directory, it is recommended that you do NOT install the unixODBC driver manager in the default directory. To make it easier to find and maintain, install it instead in its own directory.
If you already have write privileges there, you can install it in the /opt directory. Here is an example of how you might create a directory in /opt named unixODBC_x.x.x.
# cd /opt
# pwd
/opt
# ls
IBM cluster ibm pconsole
IBMinvscout csm lost+found perl
RPM_inst_root freeware mcr teradata
Tivoli hsc np_axsmod tivoli
# mkdir unixODBC_x.x.x
# ls -l
total 8
drwxr-xr-x 4 root system 256 Jun 28 2013 IBM
drwxr-xr-x 4 root system 256 Feb 24 2012 IBMinvscout
drwx------ 3 root system 256 Aug 15 2014 RPM_inst_root
drwxr-xr-x 3 root system 256 May 3 2013 Tivoli
drwxr-xr-x 3 bin bin 256 Aug 29 2010 cluster
drwxr-xr-x 3 root system 256 May 3 2013 csm
drwxrwxr-x 16 root system 4096 Jan 20 2014 freeware
drwxr-xr-x 3 root system 256 May 3 2013 hsc
drwxr-xr-x 5 root system 256 May 3 2013 ibm
drwxr-xr-x 2 root system 256 May 3 2013 lost+found
drwxr-xr-x 4 root system 256 May 3 2013 mcr
drwxrwxrwx 2 root sys 256 Dec 18 2013 np_axsmod
drwx--x--x 4 root system 256 Aug 7 2010 pconsole
drwxr-xr-x 3 root system 256 May 3 2013 perl
drwxr-xr-x 3 bin bin 256 Dec 18 2013 teradata
drwxr-xr-x 3 root system 256 May 3 2013 tivoli
drwxr-xr-x 2 root system 256 Mar 29 13:49 unixODBC_x.x.x
./configure --prefix=/opt/unixODBC_x.x.x
make
make install
If you are using a GCC compiler, set these environment variables to ensure that a 64-bit version is built.
export PATH=<directory_containing_the_gcc_compiler>:$PATH
export CFLAGS=-maix64
export ARFLAGS="-X 64"
export OBJECT_MODE=64
If you are using an xlc_r compiler, set these environment variables to be sure that particular compiler is used and the 64-bit version is built.
export PATH=<directory_containing_the_xlc_r_compiler>:$PATH
export CCC=xlc_r
export cc=xlc_r
export CXX=xlc_r
export CFLAGS=-maix64
export ARFLAGS="-X 64"
export OBJECT_MODE=64
If you try to build multiple times, issue this MAKE command before each new attempt:
make distclean
How to correct potential build problems
Problem: 32-bit objects are Created in the Archived LIBODBC.A unixODBC Driver Manager File
Once the unixODBC driver manager is built, go to the new unixODBC lib directory and issue an archive (ar) command to ensure that the right object was added to the LIBODBC.A driver manager archive file.
<aix_prompt> cd /opt/unixODBC_x.x.x/lib
<aix_prompt> ls
libodbc.a libodbccr.a libodbcinst.a
libodbc.la libodbccr.la libodbcinst.la
<aix_prompt> ar -X64 -t libodbc.a
libodbc.so.2
If the ar -X64 command shows nothing, submit this command instead.
ar -X32 -t libodbc.a
If this command shows an object, you have built a 32-bit version of the unixODBC driver
manager. See “Process” Step 3 to rebuild with the required environment variable settings f9r ea 64-bit build.
Problem: Incorrect 64-bit objects are Created in the Archived LIBODBC.A unixODBC Driver Manager File
If you issue the ar -X64 -t libodbc.a command, and you do not see the LIBODBC.SO.2 object after the unixODBC build but instead see many *.o objects, it is likely due to a GNU AUTOMAKE issue. This means that the GNU CONFIGURE or MAKE did not retrieve the correct AIX version information, which results in an incorrect build. You can correct this by editing a section of the unixODBC CONFIGURE file code and hardcoding the HOST_OS value.
host_os=$*
IFS=$ac_save_IFS
case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
# Here, the following line was added so that the host_os setting is hard-coded...this to
# correct a GNU make problem.
host_os=aix7.1
Problem: The unixODBC ISQL Query Tool Fails Due to a Missing READLINE Package Dependency
If the READLINE library is missing on AIX, the unixODBC ISQL tool fails with this error message:
Could not load program ./isql:
Dependent module libreadline.a(libreadline.so.4) could not be loaded.
Could not load module libreadline.a(libreadline.so.4).
System error: No such file or directory
SAS/ACCESS Interface to ODBC will still works with unixODBC. However, the unixODBC ISQL query tool is a useful debugging tool and in this case, it is recommended that you obtain the READLINE library.
Additional configuration steps to enable SAS/ACCESS Interface to ODBC
It is important to remember that the LIBODBC.A unixODBC driver manager on AIX is an archive file that contains objects. Initially when the unixODBC driver manager is built, it contains an object named LIBODBC.SO.2. You can use ar -X64 command to verify this.
<aix_prompt> cd /opt/unixODBC_x.x.x/lib
<aix_prompt> ls
libodbc.a libodbccr.a libodbcinst.a
libodbc.la libodbccr.la libodbcinst.la
<aix_prompt> ar -X64 -t libodbc.a
libodbc.so.2
However, when you submit SAS/ACCESS Interface to ODBC code, SAS looks for an object named ODBC.SO in the unixODBC LIBODBC. An archived driver manager file and this code fails with this error:
ERROR: Could not load module
/tdi/mva-v940m2/usrlibsas/r64no.15w08.20140723.weekly/SASFoundation/9.4
/sasexe/sasodb.
Dependent module libodbc.a(odbc.so) could not be loaded.
To fix this, extract the LIBODBC.SO.2 object from the archived LIBODBC.A file, rename it to ODBC.SO, and reinsert the ODBC.SO object into the archived LIBODBC.A file. Here is how to do this with archive commands.
r6494t03.unx.sas.com> pwd
/opt/unixODBC_x.x.x/lib
r6494t03.unx.sas.com> ls
libodbc.a libodbccr.a libodbcinst.a
libodbc.la libodbccr.la libodbcinst.la
r6494t03.unx.sas.com> ar -X64 -t libodbc.a
libodbc.so.2
r6494t03.unx.sas.com> ar -X64 -x libodbc.a libodbc.so.2
r6494t03.unx.sas.com> ls
libodbc.a libodbc.so.2 libodbccr.la libodbcinst.la
libodbc.la libodbccr.a libodbcinst.a
r6494t03.unx.sas.com> cp libodbc.so.2 odbc.so
r6494t03.unx.sas.com> ar -X64 -r libodbc.a odbc.so
r6494t03.unx.sas.com> ar -X64 -t libodbc.a
libodbc.so.2
odbc.so
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning and boost your career prospects.