在python cx_oracle连接到慢慢数据库之前增加连接timout之前的时间

发布于 2025-01-29 09:41:43 字数 609 浏览 1 评论 0原文

我正在使用python中的标准cx_oracle.connect()语句,例如

cnxn = cx_oracle.connect(user/pwd@connection:port/service)

,我正在收到此错误

databaseerror:ora:ora -12170:TNS:Connect Timeout发生

我认为这是因为我们只切换到Amazon/AWS/RDS数据库,该数据库非常慢,并且连接太早了。是否有一种简单的方法来增加等待直到超时?

到目前为止,我尝试了这些解决方案。

cx_oracle Connection timeout

https://github.com/oracle/python-cx_oracle/issues/277

I am using a standard cx_Oracle.connect() statement in python like this

cnxn = cx_Oracle.connect(user/pwd@connection:port/service)

And I am getting this error

DatabaseError: ORA-12170: TNS:Connect timeout occurred

I think it is because we just switch to a amazon/aws/rds database, which is very slow, and the connection is timing out too soon. Is there a simple way to increase the wait until the timeout occurs?

I tried these solutions with no success so far.

cx_Oracle Connection Timeout

https://github.com/oracle/python-cx_Oracle/issues/277

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

╰つ倒转 2025-02-05 09:41:43

如果您使用的是Oracle Client 19C或更高版本,则可以将连接超时添加到Easy Connect字符串中。参见 oracle noreferrer“> oracle数据库21C >:

cnxn = cx_Oracle.connect(user/pwd@connection:port/service?transport_connect_timeout=15)

还有一个connect_timeout选项,有关差异,请参见上面的技术简介链接。

If you are using Oracle Client 19c or later, you can add a connect timeout to your Easy Connect string. See Oracle Database 21c Easy Connect Plus:

cnxn = cx_Oracle.connect(user/pwd@connection:port/service?transport_connect_timeout=15)

There is also a connect_timeout option, see the tech brief link above for the difference.

[浮城] 2025-02-05 09:41:43

您可能没有cx_oracle的超时,而是与您的Oracle客户端

可以call_timeout,但通常是在初始连接后的请求。

您可以在下面更新sqlnet.ora file

SQLNET.INBOUND_CONNECT_TIMEOUT = 0

类似的问题

cx_oralce docs

You probably dont have a timeout with cx_oracle but rather with your oracle client

You can call_timeout but typically for requests after initial connection.

You can update your sqlnet.ora file as below

SQLNET.INBOUND_CONNECT_TIMEOUT = 0

Similar so question

cx_oralce Docs

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文