We’re smarter together. Learn from this collection of community knowledge and add your expertise.

How to build the latest unixODBC driver manager for Linux

by SAS Employee KatT_sas on ‎03-09-2016 11:19 AM (477 Views)

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 Linux.

 

  1. It is recommended that you use the most current version of the unixODBC driver manager. Obtain a zipped tar file (unixODBC-x.x.x.tar.gz) for unixODBC from the unixODBC project home page.  (x.x refers to the most recent subrelease. 

         Use FTP in binary mode to move this file to your UNIX machine.  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. 

 

  1. From this directory, unzip and untar the file to unpackage the unixODBC driver manager components. At this point the unixODBC-x.x subdirectory is created.  Switch to this directory before proceeding with the build.

By default, the unixODBC driver manager is installed in a directory such as /usr/lib64 on Linux.  Because this directory already contains many other third-party components, which makes it difficult to identify unixODBC-specific components, it is recommended that you do NOT install the unixODBC driver manager in that 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 unixODBCx.x.x.

 

[root@cumulus test_scripts]# cd /opt
[root@cumulus opt]# pwd
/opt
[root@cumulus opt]# ls
ibm  microsoft  np_axsmod  nz  sun  teradata  TKGrid.old  VADP  VADP.old  webmin
[root@cumulus opt]# mkdir unixODBCx.x.x
[root@cumulus opt]# ls
ibm  microsoft  np_axsmod  nz  sun  teradata  TKGrid.old  unixODBCx.x.x  VADP  VADP.old  webmin

 

  1. From the unixODBCx.x (no hyphen?) subdirectory that you created in step 2, issue the following commands to build the unixODBC driver manager. Use the --prefix option with the CONFIGURE command to specify that you want to install unixODBC in the /opt/unixODBCx.x.x directory that you just created.

  

./configure --prefix=/opt/unixODBCx.x.x 
make
make install

 

This log shows how you can build a 64-bit unixODBC x.x.x ODBC driver manager on Linux.  (Some tar-related output in STDOUT has been omitted.)

 

[sastac1@cumulus unixODBCx.x.x_download]$ uname –a (no underscore in dir name, or underscore in all?-- global)
Linux cumulus.unx.sas.com 2.6.32-131.6.1.el6.x86_64 #1 SMP Mon Jun 20 14:15:38 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux
[sastac1@cumulus unixODBC_x.x.x_download]$ pwd
/saswork/sasswl/7611263597_acc_odbc_unixodbc_oracle_netezza_sqlserver/unixODBC_x.x.x_download
[sastac1@cumulus unixODBC_x.x.x_download]$ ls
unixODBC-x.x.x.tar.gz
[sastac1@cumulus unixODBC_x.x.x_download]$ gunzip unixODBC-x.x.x.tar.gz
[sastac1@cumulus unixODBC_x.x.x_download]$ ls
unixODBC-x.x.x.tar
[sastac1@cumulus unixODBC_x.x.x_download]$ tar -xvf unixODBC-x.x.x.tar

.
.  (some output has been omitted)
.

unixODBC-x.x.x/lst/ChangeLog
unixODBC-x.x.x/lst/Makefile.in
unixODBC-x.x.x/lst/lstFirst.c
unixODBC-x.x.x/lst/TODO
unixODBC-x.x.x/ChangeLog
unixODBC-x.x.x/extras/
unixODBC-x.x.x/extras/snprintf.c
unixODBC-x.x.x/extras/Makefile.am
unixODBC-x.x.x/extras/vms.c
unixODBC-x.x.x/extras/strcasecmp.c
unixODBC-x.x.x/extras/Makefile.in
unixODBC-x.x.x/Makefile.in
unixODBC-x.x.x/README.OSX
[root@cumulus unixODBC_x.x.x_download]# ls
unixODBC-x.x.x  unixODBC-x.x.x.tar
[root@cumulus unixODBC_x.x.x_download]# cd unixODBC-x.x.x
[root@cumulus unixODBC-x.x.x]# ls
acinclude.m4  configure      Drivers    install-sh  Makefile.am    odbcinst        README.SOLARIS
aclocal.m4    configure.in   DRVConfig  Interix     Makefile.in    README          README.VMS
AUTHORS       COPYING        exe        libltdl     Makefile.svn   README.AIX      samples
ChangeLog     cur            extras     log         man            README.CYGWIN   unixodbc_conf.h.in
config.guess  depcomp        include    lst         missing        README.INTERIX  vms
config.h.in   doc            ini        ltmain.sh   mkinstalldirs  README.OSX      vmsbuild.com
config.sub    DriverManager  INSTALL    m4          NEWS           README.QNX      ylwrap

[sastac1@cumulus unixODBC_x.x.x_download]$ su root
Password:
[root@cumulus opt]# cd /opt
[root@cumulus opt]# pwd
/opt
[root@cumulus opt]# ls
ibm  microsoft  np_axsmod  nz  sun  teradata  TKGrid.old  VADP  VADP.old  webmin
[root@cumulus opt]# mkdir unixODBCx.x.x
[root@cumulus opt]# ls
ibm  microsoft  np_axsmod  nz  sun  teradata  TKGrid.old  unixODBCx.x.x  VADP  VADP.old  webmin
[root@cumulus opt]# 
[root@cumulus unixODBCx.x.x]# pwd
/opt/unixODBCx.x.x
[root@cumulus unixODBC-x.x.x]# cd /saswork/sasswl/7611263597_acc_odbc_unixodbc_oracle_netezza_sqlserver/
unixODBC_x.x.x_download/saswork/sasswl/7611263597_acc_odbc_unixodbc_oracle_netezza_sqlserver/
unixODBC_x.x.x_download/unixODBC-x.x.x
[root@cumulus unixODBC-x.x.x]# ls
acinclude.m4  configure      Drivers    install-sh  Makefile.am    odbcinst        README.SOLARIS
aclocal.m4    configure.in   DRVConfig  Interix     Makefile.in    README          README.VMS
AUTHORS       COPYING        exe        libltdl     Makefile.svn   README.AIX      samples
ChangeLog     cur            extras     log         man            README.CYGWIN   unixodbc_conf.h.in
config.guess  depcomp        include    lst         missing        README.INTERIX  vms
config.h.in   doc            ini        ltmain.sh   mkinstalldirs  README.OSX      vmsbuild.com
config.sub    DriverManager  INSTALL    m4          NEWS           README.QNX      ylwrap
[root@cumulus unixODBC-x.x.x]# ./configure --prefix=/opt/unixODBCx.x.x

.
.  (some output has been omitted)
.

checking for unistd.h... (cached) yes
checking for dl.h... no
checking for sys/dl.h... no
checking for dld.h... no
checking for mach-o/dyld.h... no
checking for dirent.h... yes
checking for closedir... yes
checking for opendir... yes
checking for readdir... yes
checking for strlcat... no
checking for strlcpy... no
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands

[root@cumulus unixODBC-x.x.x]# make

.
.  (some output has been omitted)
.

make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/saswork/sasswl/7611263597_acc_odbc_unixodbc_oracle_netezza_sqlserver/unixODBC_x.x.x_download/unixODBC-x.x.x/man'
Making all in samples
make[2]: Entering directory `/saswork/sasswl/7611263597_acc_odbc_unixodbc_oracle_netezza_sqlserver/unixODBC_x.x.x_download/unixODBC-x.x.x/samples'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/saswork/sasswl/7611263597_acc_odbc_unixodbc_oracle_netezza_sqlserver/unixODBC_x.x.x_download/unixODBC-x.x.x/samples'
make[2]: Entering directory `/saswork/sasswl/7611263597_acc_odbc_unixodbc_oracle_netezza_sqlserver/unixODBC_x.x.x_download/unixODBC-x.x.x'
make[2]: Leaving directory `/saswork/sasswl/7611263597_acc_odbc_unixodbc_oracle_netezza_sqlserver/unixODBC_x.x.x_download/unixODBC-x.x.x'
make[1]: Leaving directory `/saswork/sasswl/7611263597_acc_odbc_unixodbc_oracle_netezza_sqlserver/unixODBC_x.x.x_download/unixODBC-x.x.x'

[root@cumulus unixODBC-x.x.x]# make install

.
.  (some output has been omitted)
.

make[2]: Leaving directory `/saswork/sasswl/7611263597_acc_odbc_unixodbc_oracle_netezza_sqlserver/unixODBC_x.x.x_download/unixODBC-x.x.x/samples'
make[1]: Leaving directory `/saswork/sasswl/7611263597_acc_odbc_unixodbc_oracle_netezza_sqlserver/unixODBC_x.x.x_download/unixODBC-x.x.x/samples'
make[1]: Entering directory `/saswork/sasswl/7611263597_acc_odbc_unixodbc_oracle_netezza_sqlserver/unixODBC_x.x.x_download/unixODBC-x.x.x'
make[2]: Entering directory `/saswork/sasswl/7611263597_acc_odbc_unixodbc_oracle_netezza_sqlserver/unixODBC_x.x.x_download/unixODBC-x.x.x'
make[2]: Nothing to be done for `install-exec-am'.
touch /opt/unixODBCx.x.x/etc/odbcinst.ini
touch /opt/unixODBCx.x.x/etc/odbc.ini
mkdir -p /opt/unixODBCx.x.x/etc/ODBCDataSources
cp unixodbc_conf.h /opt/unixODBCx.x.x/include/unixodbc_conf.h
make[2]: Leaving directory `/saswork/sasswl/7611263597_acc_odbc_unixodbc_oracle_netezza_sqlserver/unixODBC_x.x.x_download/unixODBC-x.x.x'
make[1]: Leaving directory `/saswork/sasswl/7611263597_acc_odbc_unixodbc_oracle_netezza_sqlserver/unixODBC_x.x.x_download/unixODBC-x.x.x'

[root@cumulus unixODBCx.x.x]# cd /opt/unixODBCx.x.x
[root@cumulus unixODBCx.x.x]# ls
bin  etc  include  lib  share
[root@cumulus unixODBCx.x.x]# cd lib
/opt/unixODBCx.x.x/lib
[root@cumulus lib]# ls
libodbccr.la  libodbccr.so.2      libodbcinst.la  libodbcinst.so.2      libodbc.la  libodbc.so.2
libodbccr.so  libodbccr.so.2.0.0  libodbcinst.so  libodbcinst.so.2.0.0  libodbc.so  libodbc.so.2.0.0
[root@cumulus lib]# file libodbc.so
libodbc.so: symbolic link to `libodbc.so.2.0.0'
[root@cumulus lib]# file libodbc.so.2.0.0
libodbc.so.2.0.0: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, not stripped
[root@cumulus lib]#

 

Contributors
Your turn
Sign In!

Want to write an article? Sign in with your profile.