Cx_Oracle.DatabaseError: ORA-12170: TNS:Connect Timeout Occurred
I am getting cx_Oracle.DatabaseError: ORA-12170: TNS:Connect timeout occurred error while connecting oracle from python. I have installed python 3.7.0 and instantclient_11_2. Bel
Solution 1:
Try:
connection = cx_Oracle.connect('user', 'pwd', cx_Oracle.makedsn( '<ip>', '1521',None,'<given service name>'))
Looks the same but works different in my ubuntu server.
Also make sure to put the port between ' '
Solution 2:
You should also be able to use the following connect string if the database resides on the same machine:
connection = cx_Oracle.connect('user/pwd@localhost/service_name')
Note that a service_name value is required. You can't use the empty string!
Post a Comment for "Cx_Oracle.DatabaseError: ORA-12170: TNS:Connect Timeout Occurred"