I have attempted to search for a resolution or at least a few troubleshooting steps to understand why I see these errors when I execute a Python script. No luck so far. I SSH to Rackspace to do this.
The errors reference the Oracle db. To be more specific, it is cx_Oracle._Error and cx_Oracle.DatabaseError on separate occasions. Below is an example of a few lines from the server logs. It does not give any more information than that.
Running against Oracle server: prod.somecompanyname + prod123
Error connecting to databases: (<cx_Oracle._Error object at0x7ffff7fe9af8>,)
Error verifying existing Oracle records
My colleague is able to execute the script successfully and does not encounter the error. I compared our .bash_profile and .bashrc and nothing different stands out. The Oracle server credentials are correct in the script as well as the Oracle environment path. This may be isolated to something on my end however I cannot figure out where.
Any suggestions on where to look to fix this is appreciated.
def oraclerecords(logger, env, db1Pass, db2Pass, db3Pass, verifyRecordset):
import cx_Oracle
retval = None
try:
db1UID='somedb1name'
db2UID='somedb2name'
if env == 'p':
dbServer='prod.somecompanyname.com'
dbSID='SIDPR'
elif env == 's':
dbServer='stage.somecompanyname.com'
dbSID='SIDSTG'
elif env == 'r':
dbServer='stage.somecompanyname.com'
dbSID='SIDDEV'
db3UID = 'somedb3name'
db3SID = 'db3HUB'
logger.info('Running against Oracle server:' + dbServer + ' SID:' + dbSID)
connString = (db1UID + '/' + db1Pass + '@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS='
'(PROTOCOL=TCP)(HOST=' + dbServer + ')(PORT=1234)))(CONNECT_DATA=(SID=' + dbSID + ')))')
conndb1 = cx_Oracle.connect(connString)
curdb1 = conndb1.cursor()
curdb0 = conndb1.cursor()
connString = (db2UID + '/' + db2Pass + '@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS='
'(PROTOCOL=TCP)(HOST=' + dbServer + ')(PORT=1234)))(CONNECT_DATA=(SID=' + dbSID + ')))')
conndb2 = cx_Oracle.connect(connString)
curdb2 = conndb2.cursor()
connString = (db3UID + '/' + db3Pass + '@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS='
'(PROTOCOL=TCP)(HOST=prod.atsomecompany.com)(PORT=1234)))(CONNECT_DATA=(SID=' + db3SID + ')))')
conndb3 = cx_Oracle.connect(connString)
curdb3 = conndb3.cursor()
except Exception as e:
logger.error('Error connecting to databases: ' + str(e.args))
return verifyRecordset, 2
Error connecting to databases: ...I really don't see how anybody can help you here.