我正在尝试对新安装的系统进行健全性测试Oracle client 12.2 in RHEL 7 linux
来自Python程序,但它因上述错误而失败,不确定我在那里缺少什么。请帮忙解决这个案例:
cx_Oracle.DatabaseError: ORA-12514: TNS:listener does not currently know of service
requested in connect descriptor
my tnsnames.ora
文件下/home
目录
FRDLD2D1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(Host = frdld2d1.de.db.com)(Port = 1825))
)
(CONNECT_DATA =
(SID = FRDLD2D1)
)
)
我的Python程序如下
#!/usr/bin/python
import cx_Oracle
#connection = cx_Oracle.connect('PNTH_LOGGINGB_OWNER/password')
connection = cx_Oracle.connect('PNTH_LOGGINGB_OWNER/[email protected]:1825/orcl')
cursor = connection.cursor()
querystring = "select * from BDR_JOB_MASTER_LOG where ROWNUM <= 1;"
cursor.execute(querystring)
frdld2d1.de.db.com
- IP地址 : 10.245.63.34
感谢这里是否有任何问题。
tnsping
由于它是 instaclient 版本,因此无法测试该实用程序
oracle-instantclient12.2-basic-12.2.0.1.0-1.x86_64.rpm
.
但与SQLPlus
,我能够毫无问题地连接数据库。
请使用它作为您的连接字符串:
connection = cx_Oracle.connect('PNTH_LOGGINGB_OWNER', 'hdgf_76trf',
cx_Oracle.makedsn('10.245.63.34',1825,'FRDLD2D1') );
改变SID = FRDLD2D1
to SERVICE_NAME = FRDLD2D1
在你的TNSNAMES.ORA
文件可能是替代方案。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)