【发布时间】:2017-03-11 12:01:07
【问题描述】:
我正在使用 Kenneth Ritz 的记录库连接到 Oracle。
db = records.Database('oracle://scott/tiger@localhost:1521/orcl')
但它总是抛出这个错误
DatabaseError: (cx_Oracle.DatabaseError)
ORA-12545: Connect failed because target host
or object does not exist.
但是,通过 SQL Plus 连接就可以了
sqlplus scott/tiger@localhost/orcl:1521
SQL*Plus: Release 12.1.0.1.0 Production on Sat Mar 11 17:29:19 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Last Successful login time: Sat Mar 11 2017 17:16:24 +05:30
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL>
有趣的观察
db = cx_Oracle.connect('scott/tiger@localhost:1521/orcl') **<--Works**
db.version
'12.1.0.1.0'
db = records.Database('oracle+cx_oracle://scott/tiger@localhost:1521/orcl')
doesn't work
知道我在这里做错了什么吗?
【问题讨论】:
标签: python-3.x cx-oracle python-records