ORA-03135:尝试使用 python 和 cx_Oracle 模块连接到数据库时连接丢失

ORA-03135 connection lost contact while trying to connect to DB using python and cx_Oracle module

我正在尝试使用 cx_OraclepythonWindows 10 系统(基于 https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html#installing-cx-oracle-on-windows)如下:

import cx_Oracle

dsn_tns = cx_Oracle.makedsn('host', 'port', service_name='name')
conn = cx_Oracle.connect(user='username', password='passwd', dsn=dsn_tns)

我有一个错误:

cx_Oracle.OperationalError: ORA-03135: connection lost contact

Process ID: 0 Session ID: 0 Serial number: 0

我还向 sqlnet.ora 添加了 2 个参数(基于以下信息:https://www.vitalsofttech.com/ora-03135-connection-lost-contact/):

仍然出现同样的错误。

我在想这可能是防火墙的问题,但事实并非如此。我也可以使用 sqlplus.

从命令行连接到数据库

Tnspi​​ng 从我的本地机器到数据库 returns 好的。

问题已解决。

在我的本地计算机上将 Oracle 即时客户端11.2 升级到 12.1 解决了问题连接性。