Skip to Content
avatar image
Former Member

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

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Aug 07, 2012 at 11:47 AM

    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).

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 17, 2014 at 01:02 PM

    Hi Tobias,

    Thanks for the post.

    Replying here for those that are still reading your post as a result of a Google search. Just uploaded a video to the SAP HANA SPS 08 installation playlist: https://www.youtube.com/watch?v=whQTt0guROA&index=7&list=PLkzo92owKnVzjry75ID3mydr6VGX2Ul9M

    In this video, I address the ins and outs of HANA ODBC on Linux. Since SPS 02, ODBC also has been documented in the SAP HANA developer guide (chapter 13).

    Denys van Kempen, SAP HANA Academy

    Add comment
    10|10000 characters needed characters exceeded