Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

unixodbc to HANA - connect problem

I am trying to connect to HANA from unixodbc on Linux (ultimately to connect from Python). Can't get it work. Any hints?

Thanks,

Tobias

I can successfully connect using hdbsql

oberstet@ubuntu10bld_klon0:~/hana$ hdbsql -n 54.204.111.7:30015 -u SYSTEM -p secret

Welcome to the SAP HANA Database interactive terminal.

Type:  \h for help with commands

       \q to quit

hdbsql=> \s

host          : imdbhdb:30015

database      : HDB

user          : SYSTEM

kernel version: 1.00.28.361821

autocommit    : ON

hdbsql HDB=> \q

Using unixodbc it fails:

oberstet@ubuntu10bld_klon0:~/hana$ isql HANA SYSTEM secret -v

[08S01][unixODBC][SAP AG][LIBODBCHDB32 SO][HDB] Communication link failure;-10709 Connection failed (RTE:[89006] System call 'connect' failed, rc=111:Verbindungsaufbau abgelehnt)

[ISQL]ERROR: Could not SQLConnect

The DSN configuration is this:

oberstet@ubuntu10bld_klon0:~/hana$ cat /etc/odbc.ini

[HANA]

Description     = ODBC for SAP HANA

Driver          = /usr/sap/hdbclient32/libodbcHDB32.so

Host            = 54.204.111.7

Port            = 30015

Tags:
Former Member
Former Member replied

Ok, figured it out (this really needs to be documented .. lost 2 hours trial and error):

oberstet@ubuntu10bld_klon0:~/hana$ cat /etc/odbcinst.ini

[HANA]

Description     = ODBC Driver for SAP HANA

Driver          = /usr/sap/hdbclient32/libodbcHDB32.so

Then:

oberstet@ubuntu10bld_klon0:~/hana$ cat test.py

import pyodbc

conn = pyodbc.connect('DRIVER={HANA};SERVERNODE=54.204.111.7:30015;SERVERDB=HDB;UID=SYSTEM;PWD=secret')

cur = conn.cursor()

cur.execute("select * from test1.t1")

print cur.fetchall()

===

I was only able to figure out the correct connection string by reverse eng. of /usr/sap/hdbclient32/odbcreg32, which seems to be some test tool.

I was not able to setup a correct, usable DSN. Only via above (direct connection string).

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question