'Error in connecting to Database in DB2 using python
When I tried to connect the DB2 database through the following python code
python version : 3.6
ibm_db version : ibm_db-2.0.9
DB2_version : 11.5
import configparser
import ibm_db_dbi
config = configparser.ConfigParser()
config.read('File location')
server_name = config.get(conn_type, 'server_name')
database = config.get(conn_type, 'database')
username = config.get(conn_type, 'user')
password = config.get(conn_type, 'password')
conn = ibm_db_dbi.connect('Server='+server_name+';''Database='+database+';''UID=' + username + ';''PWD=' + password + ';')
print("Connection to Source established.")
I am getting the below error
unhashable type: 'list'
ERROR:root:<p>Error: unhashable type: 'list'</p>
Can someone please help me to solve this error
Solution 1:[1]
Well, I didn't try your code but following is alternative for your code
In [1]: import ibm_db
In [2]: conn = ibm_db.connect("DATABASE=SAMPLE;HOSTNAME=<hostname>;PORT=<port>;UID=db2inst1;PWD=password;","","")
In [3]:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Nilesh Solanki |
