Skip to end of metadata
Go to start of metadata

In order to use unixODBC Manager, the binary of the software must be created according to the platform. This chapter describes the necessary parts for each step. It is assumed that the compiler uses the native compiler, and in the case of gcc/g++, there are no options to pay attention to, so there will be no explanation. (However, when creating 32/64bit, the compile option must be used carefully.)

Downloading unixODBC Manager

The user can download the unixODBC Manager from the following web address:
  • 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.

2. Setting environment variables for compilation

Check the bit of the odbc driver to be used.

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.

Icon

The bit types of the unixodbc and odbc driver must match each other. If unixodbc is compiled with 64bit, the Altibase odbc driver must also use 64bit, and if the unixodbc is 32bit, the 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.

 


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

Icon

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.

 

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

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.

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.

4. Compiling

perform make

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.

 


Check for the normal installation

Check if the library is loaded normally after installation


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 provided by ALTIBASE should run normally.


  • No labels