Python: Setting Timeout in Oracle function – cx_Oracle.connect

self.connection = cx_Oracle.connect( args.user, args.password, args.dsn)

To fix this , create an environment TNS_ADMIN and save file sqlnet.ora , add these line to control the timeout

SQLNET.OUTBOUND_CONNECT_TIMEOUT=10 ms

import os
os.environ["TNS_ADMIN"] = "/script/tnsadmin"

 cx_Oracle.connect(                args.user, args.password, args.dsn)

Leave a Reply

Your email address will not be published. Required fields are marked *