我正在尝试使用python中的cx_Oracle链接到Oracle数据库并继续收到错误:
DatabaseError: ORA-12170: TNS:Connect timeout occurred
以下是我正在运行的代码:
import cx_Oracle
dsn_tns = '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=*ip*)(PORT=*port*))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=*service_name*)))'
db= cx_Oracle.connect('*username*', '*password*', dsn_tns, encoding="UTF-8")