I have a code that connect to oracle using connection string:
conn = cx_Oracle.connect(\'username/password@server:port/services\')
But the
You can use any of the following way based on Service Name
or SID
whatever you have.
With SID:
dsn_tns = cx_Oracle.makedsn('server', 'port', 'sid')
conn = cx_Oracle.connect(user='username', password='p@ssword', dsn=dsn_tns)
OR
With Service Name:
dsn_tns = cx_Oracle.makedsn('server', 'port', service_name='service_name')
conn = cx_Oracle.connect(user='username', password='p@ssword', dsn=dsn_tns)