cancel
Showing results for 
Search instead for 
Did you mean: 

hdbcli.dbapi.Error: (10, "authentication failed:.. while connecting HANA Cloud with local python prg

Hydrargyrum09
Discoverer
0 Kudos
227

Hi everyone, so today I created a HANA Cloud database and already configured it so it Allows all IP Addresses; then I want to try to connect to that database directly from my local Python program using hdbcli. Here is the code that I use to connect:

import os
from flask import Flask
from cfenv import AppEnv
from hdbcli import dbapi

app = Flask(__name__)
env = AppEnv()

# hana_service = None
# hana = env.get_service(label=hana_service)

port = int(os.environ.get('PORT', 3000))
@app.route('/')
def hello():
    conn = dbapi.connect(address='8ec92110-...-...-...-.hana.trial-us10.hanacloud.ondemand.com',
                            port=443,
                            user='HANAUSER',
                            password='UserHanaPass.99',
                            encrypt=True,
                            sslValidateCertificate=False
                            )

    cursor = conn.cursor()
    cursor.execute("select CURRENT_UTCTIMESTAMP from DUMMY")
    ro = cursor.fetchone()
    cursor.close()
    conn.close()

    return "Current time is: " + str(ro["CURRENT_UTCTIMESTAMP"])

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=port)

this is the full error message:

  File "D:\Cognitus\IFRS\1.IFRS 9 Concept\Code\.venv\lib\site-packages\flask\app.py", line 865, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]  
  File "d:\Cognitus\IFRS\1.IFRS 9 Concept\Code\server_direct.py", line 15, in hello
    conn = dbapi.connect(address='8ec92110-7253-4e50-9c4a-05a53ab55162.hana.trial-us10.hanacloud.ondemand.com',
hdbcli.dbapi.Error: (10, "authentication failed: Detailed info for this error can be found with correlation ID '0BB7FCD761027446922C598C547781DC'")so what i missed here? thanks!
  

 

View Entire Topic
Vitaliy-R
Developer Advocate
Developer Advocate
0 Kudos

You need to log on to your instance with the DBADMIN user and check what the full error message is for the correlation-id `0BB7FCD761027446922C598C547781DC` by running the query:

SELECT * FROM SYS.AUTHENTICATION_ERROR_DETAILS 
WHERE CORRELATION_ID = '0BB7FCD761027446922C598C547781DC';

 Regards,
--Vitaliy

Hydrargyrum09
Discoverer
WHOAA THANKSS!!, from the detail log i found out that i use the database name for login, should be my administration user