Home  >  Q&A  >  body text

Python connects to Oracle and reports an error TNS. The listener is currently unable to recognize the service requested in the connection descriptor.

import cx_Oracle
conn = cx_Oracle.connect('gxb2b/OpG�cP@10.182.22.34:2700/gx36')
print (conn.version)

The cx_Oracle module has been installed, but an error occurs when running sublime. Any ideas or solutions

世界只因有你世界只因有你2603 days ago685

reply all(3)I'll reply

  • 阿神

    阿神2017-05-18 10:53:16

    Oracle可以通过别的客户端连接吗?出现TNS监听错误,很可能是Oracle服务器的问题,还有你的这个连接中,Oracle的Sid写对没?这两点都有可能

    reply
    0
  • 天蓬老师

    天蓬老师2017-05-18 10:53:16

    可以连接了,原因是连接库用的库名,我连接时用的是plsql连接用的名字,显然是不对的。。。
    谢谢你的回答

    reply
    0
  • 阿神

    阿神2017-05-18 10:53:16

    有2种可能,第1种是服务器端没有配置TNS文件,第2种可能是服务器端监听的端口不是2700。

    reply
    0
  • Cancelreply