I have saved the DB2 username and DB2 password as 'DB2_USER' and 'DB2_PASS' in .bashrc(linux). And, I'm trying to invoke them in my python program to connect to DB2 database.
.bashrc content:
export DB2_USER="my_username"
export DB2_PASS="my_password"
My python code snippet:
db_user = os.environ.get('DB2_USER')
db_password = os.environ.get('DB2_PASS')
conn = ibm_db.connect('DRIVER={IBM DB2 ODBC DRIVER};DATABASE=<my_db>;HOSTNAME=<my_hostname>;PORT=50000;PROTOCOL=TCPIP;UID=db_user;pwd=db_password','','')
while executing the above code , I'm getting the below error. May I know for any other alternative ways?
Traceback (most recent call last): File "test.py", line 38, in conn = ibm_db.connect('DRIVER={IBM DB2 ODBC DRIVER};DATABASE=<my_db>;HOSTNAME=<my_hostname>;PORT=50000;PROTOCOL=TCPIP;UID=db_user;pwd=db_password','','') Exception: [IBM][CLI Driver] SQL30082N Security processing failed with reason "24" ("USERNAME AND/OR PASSWORD INVALID"). SQLSTATE=08001 SQLCODE=-30082