Skip to Content

connect to HANA Database via ODBC

Hello,

I'm currently facing a problem when connecting to HANA database via ODBC. It works properly when I omit Parameter "DATABASENAME". But when I try to Connect using this Parameter, I always receive a "General error; 2 General error: database '<dbname>' does not exist. I've alread read about a similar problem, where incorrect port-no. seemed to cause the Problem. Well, I'm connecting to a multi-tenant DB and use 30015 as port-no. How can I retrieve proper port?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Dec 22, 2017 at 09:31 AM

    Hello ,

    please check folowing blog post:

    https://blogs.sap.com/2017/12/04/hey-sap-hana-express-edition-any-idea-whats-your-sql-port-number/

    It clearly says how to retrieve the port numbers for multitenant databases.

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 22, 2017 at 09:48 AM

    connect to the SystemDB via port 3<instance no>13 plus the DATABASENAME. That will trigger the SAP HANA client to query the SystemDB for the actual port of the database.

    Add comment
    10|10000 characters needed characters exceeded

    • Tried out "...SERVERNODE=srvsbodev10:30013;DATABASENAME=SBODEMODE"

      Exception is "ERROR [08S01] [SAP AG][LIBODBCHDB32 DLL][HDBODBC32] Communication link failure;-10709 Connect failed (connect timeout expired)"

  • Dec 22, 2017 at 09:52 AM

    Hello Bartosz,

    Thank you very much for your soon Response!

    I checked the blog post and run SQL-Statement on our Server. It returned

    So, in my opinion port-no 30015 is appropriate for ODBC-Connectstring:

    DRIVER={HDBODBC32};UID=SYSTEM;PWD=<pwd>;SERVERNODE=srvsbodev10:30015;DATABASENAME=SBODEMODE

    As this doesn't work, I also tried port-no 39013 (System tenant) which also failed.

    I'm wondering, why using port 30015 works when ommiting DATABASENAME-Option. If port-no was not correct, it should work at all

    Add comment
    10|10000 characters needed characters exceeded

    • The "initial catalog" in SAP HANA is the database users own schema.

      You can set a different current schema when connecting to the database via the CURRENTSCHEMA parameter or, once connected, change the current schema via SET SCHEMA <SCHEMA NAME>.

      There's no need to change your application code for that.