Python 服务器到 Oracle 数据库

Python server to Oracle database

我已使用以下代码通过我的本地 PC 连接到 Oracle DB。

con = cx_Oracle.connect("user/pw@host:port/service_name")
cur = con.cursor()

现在我可以使用 python 服务器,我想在 python 服务器上做同样的工作。

我很困惑是否应该像在本地 PC 上那样在 Python 服务器上安装 Oracle Client。因为相同的代码在 python 服务器上不起作用。错误信息如下所示。

DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: "libclntsh.so: cannot open shared object file: No such file or directory".

我不知道 'Python server' 是什么,但是根据错误消息,您需要安装 64 位 Oracle 客户端库并确保您的系统库搜索路径包含它们。该消息提供了一个 link 以及您可以遵循的步骤,或者您可以使用 cx_Oracle installation instructions.

有一个 architecture diagram in the cx_Oracle documentation 可能有用。

DPI 错误消息中是否有令人困惑的内容?您能提出改进建议吗?

您可能需要安装 python - oracle 依赖项才能使您的连接正常工作