[unixODBC-support] configuring to use alternate unixODBC driver

Michael König michael.koenig at blue-yonder.com
Fri Jan 30 14:45:06 GMT 2015


Hi Harold!

In our company we had a similar issue once. We perform a custom compile 
of unixODBC and use this version
instead of the one that comes with the system (SUSE, Ubuntu, or Debian 
in our case). We basically change our system environment
when we need to access unixODBC. In our case, we source a custom file

 > source use_unixodbc.sh

in the shell. We put this file in install directory of unixODBC (the one 
that contains bin and lib subfolders). Here is what it contains:

--- contents of file use_unixodbc.sh ---
UNIXODBC_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

export UNIXODBC_INCLUDE_DIR=$UNIXODBC_HOME/include
export UNIXODBC_LIB_DIR=$UNIXODBC_HOME/lib

export PATH=$UNIXODBC_HOME/bin:$PATH
export LD_LIBRARY_PATH=$UNIXODBC_LIB_DIR:$LD_LIBRARY_PATH

The first two exports define environment variables for use when 
compiling custom ODBC applications, drivers, etc.
The third export basically puts the isql binary before any other isql 
binaries found in the system.

The fourth export manipulates the order in which dynamic libraries are 
accessed. By putting $UNIXODBC_LIB_DIR before
the current $LD_LIBRARY_PATH, our custom libodbc.so has priority over 
other libodbc.so versions in /urs/lib or /usr/lib64.

This should solve your problem. Check the LD_LIBRARY_PATH variable 
afterwards to make sure the script works as expected:

 > echo $LD_LIBRARY_PATH

Note that drivers built for unixODBC 2.2.12 and below use 32 bit 
integers in some places. You may need to update your dirvers as well.

Hope this helps!

Michael



> That's where it is.  My problem is I don't know how to tell linux to 
> load it instead of the system version in /usr/lib and /usr/lib64
>
> Thanks
>
> HJarold
>


More information about the unixODBC-support mailing list