如何从 OCI Datascience Notebook(Python) 无需钱包即可访问 OCI ADW
我已经在 OCI 中创建了自治数据仓库,并尝试按照此文档从 OCI 数据科学笔记本访问它 不使用钱包连接 Python
我还安装了 Oracle Instant Client 19.6 并添加了上述文档中提到的符号链接,但脚本正在查找钱包文件并引发错误: ORA-28759: 无法打开文件
代码:
import cx_Oracle as cx
import sys
dsn = """(description= (retry_count=15)(retry_delay=3)(address=(protocol=tcps)
<my-connection-string> C=US")))"""
try:
con = cx.connect(user="<my-user>", password="<my-password>", dsn=dsn, encoding="UTF-8")
print("Database version:", con.version)
except Exception as err:
print(err)
sys.exit(1)
是的,我检查了其他相关问题,但没有运气!提前致谢。
I have created Autonomous Data Warehouse in OCI and trying to access it from OCI Data science notebooks by following this docs Connect Python without a Wallet
I have also installed Oracle Instant Client 19.6 and added symlink as mentioned in above doc but the script is looking for wallet file and throws error:ORA-28759: failure to open file
Code:
import cx_Oracle as cx
import sys
dsn = """(description= (retry_count=15)(retry_delay=3)(address=(protocol=tcps)
<my-connection-string> C=US")))"""
try:
con = cx.connect(user="<my-user>", password="<my-password>", dsn=dsn, encoding="UTF-8")
print("Database version:", con.version)
except Exception as err:
print(err)
sys.exit(1)
Yes, I've checked other related questions but no luck! Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 cx_Oracle 驱动程序,您需要 Instant Client 19.14(或更高版本)或 21.5(或更高版本)。此版本添加了单向 TLS 支持。
使用最新版本的驱动程序,该驱动程序已重命名为 python-oracledb(请参阅 发布公告),如果您想使用 “厚”模式。默认情况下,使用 Thin 模式,无论有没有钱包都可以连接到 ADW。
如果您以前使用 mTLS 时有一个 sqlnet.ora 文件,那么您应该将其删除:很可能您有一个文件,并且正在查找该文件中的钱包位置并给出错误。
然后按照文档或新博客 使用 Python 轻松无钱包连接到 Oracle 自治数据库
(是的,从技术上讲,该功能可与 Linux 上的 recut 19.13 Instant Client 一起使用,如文档中所述,但是现已被取代,并且从 19.14 和 21.5 开始,该功能可在更多架构上使用)
With the cx_Oracle driver you need Instant Client 19.14 (or later), or 21.5 (or later). The 1-way TLS support was added to this version.
With the newest release of the driver, which got renamed python-oracledb (see the release announcement), you only need Instant Client if you want to use the 'Thick' mode. By default, the Thin mode is used and it can connect to ADW with, or without, wallets.
If you have a sqlnet.ora file from a previous use of mTLS, then you should remove it: it's likely you have one and the wallet location in that file is being looked up and giving you the error.
Then follow the doc or the new blog Easy wallet-less connections to Oracle Autonomous Databases in Python
(Yes technically the feature is useable with the recut 19.13 Instant Client on Linux as noted in the doc, but that is now superseded and the feature is available on more architectures from 19.14 and 21.5 onward)