There are 2
methods of installing unixODBC
:
(1) Use packages provides by OS vendors, such as:
yum install unixODBC
(2) Download the source code from unixODBC website, and build it:
./configure
make
make install
Please notice: by default, the configuration files are in /etc/unixODBC
:
# odbcinst -j
unixODBC 2.3.1
DRIVERS............: /etc/unixODBC/odbcinst.ini
SYSTEM DATA SOURCES: /etc/unixODBC/odbc.ini
FILE DATA SOURCES..: /etc/unixODBC/ODBCDataSources
USER DATA SOURCES..: /root/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8
And this may introduce the following connection error:
# isql HDB system xxxxxx -v
[08S01][unixODBC][SAP AG][LIBODBCHDB SO][HDBODBC] Communication link failure;-10709 Connect failed (no reachable host left)
[ISQL]ERROR: Could not SQLConnect
The solution is either you create a symbol link of /etc/odbc.ini
which points to /etc/unixODBC/odbc.ini
:
ln -s /etc/unixODBC/odbc.ini /etc/odbc.ini
Or when compiling from source code, specify the sysconfdir
option in configuring process:
./configure --sysconfdir=/etc
The odbc.ini
file is like this:
[HDB]
Driver = /usr/sap/hdbclient/libodbcHDB.so
servernode = localhost:30015
The 00
in 30015
is the instance number of SAP HANA
.
When using isql
to connect SAP HANA
database, if not provide user name and password, the error message is a little confused:
# isql HDB -v
[08S01][unixODBC][SAP AG][LIBODBCHDB SO][HDBODBC] Communication link failure;-10709 Connection failed (RTE:[-1] Kerberos error. Major: "unspecified [851968]", minor: "No Kerberos credentials available [2529639053/-1765328243]")
[ISQL]ERROR: Could not SQLConnect
But after specifying the user name and password, the connection is OK:
# isql HDB system xxxxxx -v
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL>
Reference:
Connect to HANA with unixODBC fails.
Good Entry! this was very helpful
Thanks a lot! I was missing the symbol link 🙂
Thank you for sharing.