Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The user can download the unixODBC Manager from the following web address:
Image Modified
  • Download from the following web address http://www.unixodbc.org -> Click Download on the left side of the screen -> Click Download button to download the source.

The downloaded unixODBC is a compressed file in the following format.

unixODBC-2.3.2.tar.gz

Installation unixODBC Manager

To install unixODBC, perform the following process.

1. Decompressing the source

Decompress the source in the appropriate path.

Code Block
Shell> mkdir install
 
Shell> cd install
 
Shell> gzip -dc unixODBC*.gz | tar xvf -

2. Setting environment variables for compilation

Check the bit of the odbc driver to be used.

Code Block
Shell> file $ALTIBASE_HOME/lib/libaltibase_odbc*
 
/altibase_home/lib/libaltibase_odbc-64bit-ul32.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped
/altibase_home/lib/libaltibase_odbc-64bit-ul64.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped

Based on the identified bits, it is necessary to determine which bit of 32/64bit unixODBC Manager is to be compiled. Please note that ul32/ul64 included in the odbc driver file name does not mean the file bit of the odbc driver.

ul32 means that the driver is using SQLLEN=4byte(32bit), and ul64 means that the driver is using SQLLEN=8byte(64bit).

The bit-type of the file is classified according to ELF 64-bit and ELF 32-bit in the execution result of the above command.

Info

The bit types of the unixodbc and odbc driver must match each other. If unixodbc is compiled with 64bit, the altibase Altibase odbc driver must also use 64bit, and if the unixodbc is 32bit, the altibase Altibase odbc driver also uses 32bit which is a dedicated odbc driver.

Setting the size of SQLLEN and SQLULEN type

SQLEN and SQLULEN types are used when declaring the parameter variable type of the unixodbc function. Depending on the size of SIZEOF_LONG_INT, it is determined whether the size of SQLEN and SQLULEN is 32bit or 64bit. SQLLEN / SQLULEN size is declared as 32bit in 32bit OS and 64bit in 64bit OS.
To use SQLLEN/SQLULEN as 32bit (4byte) in 64bit OS, declare the following compilation environment variable.

 

Code Block
export CFLAGS=-DBUILD_LEGACY_64_BIT_MODE=1


If BUILD_LEGACY_64_BIT_MODE=1 is set as above, SQLLEN is compiled to use 32bit (4byte) size.

SQLLEN / SQLULEN type size must be used as 32bit

Warning

Using export CFLAGS=-DBUILD_LEGACY_64_BIT_MODE=1, it is strongly recommended to use SQLLEN as 4 bytes (32 bits). When SQLLEN/SQLULEN is used as 64bit (8byte), an error occurred in the transfer of values between unixodbc and altibase.

Because of this, when using the SQLColAttribute function of unixODBC in PHP/Python, the column type classification value transferred as an argument value may be calculated as an incorrect value and the value may not be retrieved normally, so SQLLEN=4byte(32bit) should be used.

Also, sqltypes.h provided by ALTIBASE is a 32-bit SQLLEN if no other option is given at compile-time, so when an application program uses ALTIBASE sqltypes.h, SQLLEN is transferred to the unixodbc manager as 32-bit.

However, if the unixodbc manager does not give a separate option, the SQLLEN is used as 64bit, so the ODBC functions SQLfetch() and SQLMoreResult() intermittently transfer incorrect return values due to the mismatch of the SQLLEN length between the application program and the unixodbc manager.

To prevent this, it is recommended to use only 32bit unixodbc SQLLEN.

Selecting uniodbc compilation bit type

it can selectively compile unixodbc to 32bit or 64bit with the compilation environment variable. It is compiled as 64bit by default in 64bit OS. To compile unixodbc with 32bit program in 64bit OS, set as follows.

Code Block
export CFLAGS=<32/64bit compile option>
export LDFLAGS=<32/64bit compile option>
export CC=<C compiler>
export CXX=<C++ compiler>

 

Environment variables to be set for each platform are as follows.

Variable
AIX
HP
SUN

64bit

compile

OBJECT_MODE=64 in the environment variable

Add "+DD64 -DBUILD_REAL_64_BIT_MODE" to CFLAGS.

Set "/usr/lib/64" and "/usr/ucblib/sparv9" in LD_LIBRARY_PATH_64.

CC

/usr/vac/bin/xlc

/opt/aCC/bin/aCC

/opt/SUNWspro/bin/cc

CFLAGS

LDFLAGS

-q64 (64bit)

+DD64 (64bit)

-xarch=v9 (64bit)

CXX

/usr/vacpp/bin/xlC_r

/opt/aCC/bin/aCC

/opt/SUNWspro/bin/CC

LD

 

 

/opt/SUNWspro/bin/CC

In the case of the compiler, the path can be changed depending on the path installed by the user, so the user must check the path installed in the target device.

The options of CFLGAS and LDFLAGS are also specified differently according to the 32/64bit compilation option. (ELF class error may occur)

Example of a compilation environment variable to compile unixodbc to 32bit on Linux 64bit OS

Code Block
export CFLAGS="-m32 -DBUILD_LEGACY_64_BIT_MODE=1"
export LDFLAGS=-m32
export CXXFLAGS=-m32

After declaring as above and going with the subsequent compilation process, unixodbc with a SQLLEN size of 4 bytes (32 bits) and an executable file bit number of 32 bits is compiled.

3. Configuration process for the 'make' process

Perform the configuration. Here, the directory to be installed and some options required for the make process are set.

Code Block
Shell> ./configure –prefix=/home/unixODBC –-disable-gui --enable-threads=yes
checking for a BSD-compatible install..../install-sh -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
…….

In the configuration stage, all environments for compiling are checked, so if an error occurs, necessary binaries must be installed directly.

The directory where unixODBC is installed is installed in the path set as the prefix argument value. For example, if prefix=/home/unixODBC, unixODBC is finally installed in /home/unixODBC after install operation.

Code Block
prefix: path to install unixODBC
enable-gui: Whether to build GUI ODBC Administrator
enable-threads: The default is "yes" if thread-support is found on your machine. All modern Linuxes will have pthreads support in glibc so it is probably best to leave this to default.
If the enable-threads option is set to no, the following error may occur when testing the connection with isql, so set enable-threads=yes.
$ ./isql Altiodbc
./isql: symbol lookup error: /home/altibase_home/lib/libaltibase_odbc-64bit-ul64.so: undefined symbol: pthread_sigmask

4. Compiling

perform make

Code Block
Shell> make
source='lstDelete.c' object='lstDelete.lo' libtool=yes \DEPDIR=.deps depmode=none /bin/bash ../depcomp \ -mt -c -o lstDelete.lo lstDelete.c
……
make[1]: Leaving directory `/home/unixODBC-2.3.2/samples'
make[1]: Entering directory `/home/unixODBC-2.3.2'
make[1]: Nothing to be done for `all-am'.
make[1]: Leaving
directory `/home/unixODBC-2.3.2'

In the case of AIX, it may be estimated that there may be errors in compilation depending on the patch level of the operating system.

Perform make install

When performing make is finished, the binary files completed with compilation are installed in the installation directory by executing make install. Since it is installed in the prefix directory specified in the configuration step, you must have access rights to the directory in advance.

 

Code Block
Shell> make install
…..
mkdir -p /home/unixODBC/etc/ODBCDataSources
/home/unixODBC/bin/odbc_config --header >
/home/unixODBC/include/unixodbc_conf.h
make[2]: Leaving directory `/home/unixODBC-2.3.2'
make[1]: Leaving
directory `/home/unixODBC-2.3.2'


Check for the normal installation

Check if the library is loaded normally after installation
Code Block
Shell> cd /home/unixODBC/bin
Shell>  ./dltest $ALTIBASE_HOME/lib/libaltibase_odbc-64bit-ul32.so
SUCCESS: Loaded /home/altibase_home/lib/libaltibase_odbc-64bit-ul32.so


The dltest file is located under the bin in the directory where unixODBC is installed. If unixODBC Manager is normally installed as above, dltest for the ODBC driver for unix Unix provided by ALTIBASE should run normally.

...