在python cx_oracle连接到慢慢数据库之前增加连接timout之前的时间
我正在使用python中的标准cx_oracle.connect()语句,例如
cnxn = cx_oracle.connect(user/pwd@connection:port/service)
,我正在收到此错误
databaseerror:ora:ora -12170:TNS:Connect Timeout发生
我认为这是因为我们只切换到Amazon/AWS/RDS数据库,该数据库非常慢,并且连接太早了。是否有一种简单的方法来增加等待直到超时?
到目前为止,我尝试了这些解决方案。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您使用的是Oracle Client 19C或更高版本,则可以将连接超时添加到Easy Connect字符串中。参见 oracle noreferrer“> oracle数据库21C >:
还有一个
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:
There is also a
connect_timeout
option, see the tech brief link above for the difference.您可能没有
cx_oracle
的超时,而是与您的Oracle客户端可以
call_timeout
,但通常是在初始连接后的请求。您可以在下面更新
sqlnet.ora
file类似的问题
cx_oralce docs
You probably dont have a timeout with
cx_oracle
but rather with your oracle clientYou can
call_timeout
but typically for requests after initial connection.You can update your
sqlnet.ora
file as belowSimilar so question
cx_oralce Docs