Apr-24-2020, 12:33 PM
while using Jupyter NB am connecting to my DB.
code i write is:
try:
conn = ibm_db.connect(dsn, "dashdb-txn-sbox-yp-lon02-04.services.eu-gb.bluemix.net,")
print ("Connected to database: ", dsn_database, "BLUDB: ", dsn_uid, "zxw96000: ", dsn_hostname)
except:
print ("Unable to connect: ", ibm_db.conn_errormsg())
Error I get is:
code i write is:
try:
conn = ibm_db.connect(dsn, "dashdb-txn-sbox-yp-lon02-04.services.eu-gb.bluemix.net,")
print ("Connected to database: ", dsn_database, "BLUDB: ", dsn_uid, "zxw96000: ", dsn_hostname)
except:
print ("Unable to connect: ", ibm_db.conn_errormsg())
Error I get is:
Error:--------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-32-f542abbf5e0c> in <module>
1 try:
----> 2 conn = (ibm_db).connect(dsn, "dashdb-txn-sbox-yp-lon02-04.services.eu-gb.bluemix.net,")
3 print ("Connected to database: ", dsn_database, "BLUDB: ", dsn_uid, "zxw96000: ", dsn_hostname)
NameError: name 'ibm_db' is not defined
During handling of the above exception, another exception occurred:
NameError Traceback (most recent call last)
<ipython-input-32-f542abbf5e0c> in <module>
4
5 except:
----> 6 print ("Unable to connect: ", ibm_db.conn_errormsg())
NameError: name 'ibm_db' is not defined
what am i doing wrong?