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?
CodePudding user response:
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
CodePudding user response:
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.