Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cx_Oracle Connection Timeout

I am trying to connect to Oracle database but getting below error:

curcon = cx_Oracle.connect(conn_str) cx_Oracle.DatabaseError: ORA-12170: TNS:Connect timeout occurred

Here's block of code:

conn_str = u'user/[email protected]:8000/service'
curcon = cx_Oracle.connect(conn_str) 
cursor = curcon.cursor()

I tried solutions from these two threads but none of them works:

Set database connection timeout in Python

ORA-12170: TNS:Connect timeout occurred

like image 268
django-unchained Avatar asked Sep 07 '26 05:09

django-unchained


1 Answers

If the error is occurring because of a slow network or system, you may fix the error by reconfiguring the following parameter in sqlnet.ora to larger values:

SQLNET.INBOUND_CONNECT_TIMEOUT = 0

Your sqlnet.ora file can be found in your $ORACLE_HOME/network/admin directory.

like image 102
gfajardog Avatar answered Sep 10 '26 05:09

gfajardog



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!