如何在远程计算机中连接 Python 中的 Oracle 数据源?
How can I connect Oracle datasource in Python in Remote Machine?
我正尝试在我的远程机器上使用 Python 连接 Oracle 数据源。
我的 python 版本和 cx_Oracle 详细信息如下,
这是我连接 Oracle 的代码,
import cx_Oracle
dsn_tns = cx_Oracle.makedsn('host_name', 'port', service_name='service_name')
conn = cx_Oracle.connect(user='user', password='pws', dsn=dsn_tns)
c = conn.cursor()
c.execute('select * from DB.TABLE')
for row in c:
print(row[0])
conn.close()
甚至 python 和 Oracle 都是 32 位的,我遇到了 32 位 Oracle 客户端库问题。
Exception has occurred: DatabaseError
DPI-1047: Cannot locate a 32-bit Oracle Client library: "The specified module could not be found". See https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html for help
谁能帮我解决这个问题?
不太确定如何在远程计算机上管理它。如果你在终端上向 运行 建议命令,我将很容易在远程机器上处理。
问题已解决。
我从 link https://www.oracle.com/in/database/technologies/instant-client/microsoft-windows-32-downloads.html(基本包)下载了 32 位 Oracle Instant 客户端文件(zip)并在环境变量中设置 PATH 解决了我的问题。
我正尝试在我的远程机器上使用 Python 连接 Oracle 数据源。
我的 python 版本和 cx_Oracle 详细信息如下,
这是我连接 Oracle 的代码,
import cx_Oracle
dsn_tns = cx_Oracle.makedsn('host_name', 'port', service_name='service_name')
conn = cx_Oracle.connect(user='user', password='pws', dsn=dsn_tns)
c = conn.cursor()
c.execute('select * from DB.TABLE')
for row in c:
print(row[0])
conn.close()
甚至 python 和 Oracle 都是 32 位的,我遇到了 32 位 Oracle 客户端库问题。
Exception has occurred: DatabaseError
DPI-1047: Cannot locate a 32-bit Oracle Client library: "The specified module could not be found". See https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html for help
谁能帮我解决这个问题?
不太确定如何在远程计算机上管理它。如果你在终端上向 运行 建议命令,我将很容易在远程机器上处理。
问题已解决。 我从 link https://www.oracle.com/in/database/technologies/instant-client/microsoft-windows-32-downloads.html(基本包)下载了 32 位 Oracle Instant 客户端文件(zip)并在环境变量中设置 PATH 解决了我的问题。