[unixODBC-dev] Compiling unixODBC with MySQL driver on AIX

k_runarsson at simnet.is k_runarsson at simnet.is
Fri Apr 12 11:23:11 BST 2013


Hello,
I'm trying to get unixODBC working on AIX 7.1, so far I have done the following:


1) I have downloaded unixODBC 2.3.0 and compiled it with the following options:

export CC=xlc_r
export CXX=xlC_r
export CFLAGS="-q32 -qlanglvl=extended -ma -O2 -g -qstrict -qoptimize=2 -qmaxmem=8192"
export CXXFLAGS="-q32 -ma -O2 -g -qstrict -qoptimize=2 -qmaxmem=8192"
export LDFLAGS="-Wl,-brtl"
export OBJECT_MODE=32

./configure --enable-gui=no --enable-drivers=no > c.log

N.B: The install script does not seem work correctly on AIX 7.1.


2) I then downloaded MySQL 5.6.10:

wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.10.tar.gz/from/http://cdn.mysql.com/ -O mysql-5.6.10.tar.gz

and added the following to CMakeLists.txt:

SET(CMAKE_C_FLAGS "-q32 -qlanglvl=extended -ma -O2 -g -qstrict -qoptimize=2 -qmaxmem=8192 -lC -liconv" CACHE STRING "Forced C compiler flags." FORCE)
SET(CMAKE_CXX_FLAGS "-q32 -ma -O2 -g -qstrict -qoptimize=2 -qmaxmem=8192" CACHE STRING "Forced C++ compiler flags." FORCE)
SET(CMAKE_C_COMPILER "/usr/vac/bin/xlc_r")
SET(CMAKE_CXX_COMPILER "/usr/vacpp/bin/xlC_r")
SET(WITHOUT_SERVER "ON" CACHE BOOL "Forced no server." FORCE)

After verifying that these settings took effect in CMakeCache.txt I built MySQL to get the client libraries only and installed them.


3) I downloaded the MySQL ODBC connector you recommended on your drivers page:

http://dev.mysql.com/get/Downloads/Connector-ODBC/5.2/mysql-connector-odbc-5.2.4-src.tar.gz/from/http://cdn.mysql.com/ -O mysql-connector-odbc-5.2.4-src.tar.gz

and added the following to CMakeLists.txt:

SET(WITH_UNIXODBC "1" CACHE INTERNAL "Forced use unixODBC" FORCE)
SET(CMAKE_C_FLAGS "-q32 -qlanglvl=extended -ma -O2 -g -qstrict -qoptimize=2 -qmaxmem=8192 -lC -li
conv" CACHE STRING "Forced C compiler flags." FORCE)
SET(CMAKE_CXX_FLAGS "-q32 -ma -O2 -g -qstrict -qoptimize=2 -qmaxmem=8192" CACHE STRING "Forced C+
+ compiler flags." FORCE)
SET(CMAKE_C_COMPILER "/usr/vac/bin/xlc_r")
SET(CMAKE_CXX_COMPILER "/usr/vacpp/bin/xlC_r")

After verifying that these settings took effect in CMakeCache.txt I built MySQL to get the client libraries only and installed them.


4) Finally I added this .odbc.ini file to my home directory

[MySQL]
Driver    = /usr/local/lib/libmyodbc5w.so
DATABASE  = my_database
USER      = my_user
PASSWORD  = my_pass
SERVER    = my_server

and then tried to access the database using /usr/local/isql TEST_MySQL -v but all I get is this error:

[IM004][unixODBC][Driver Manager]Driver's SQLAllocHandle on SQL_HANDLE_HENV failed
[ISQL]ERROR: Could not SQLConnect

...which appears to be occurring during the driver loading phase. I'm quite frankly stumped. As far as I can tell I have done everything correctly and according to the MySQL tutorials. Does anybody have an idea what I might be doing wrong? Is there another MySQL driver I can try to use? As far as I can tell the drives no longer ship with unixODBV except for MiniSQL and Postgres drivers.

Cheers
KR


More information about the unixODBC-dev mailing list