oracle / python-cx_Oracle

Python interface to Oracle Database now superseded by python-oracledb
https://oracle.github.io/python-cx_Oracle
Other
887 stars 360 forks source link

wallet.sso tcps wrong host hangs forever #624

Closed fenchu closed 2 years ago

fenchu commented 2 years ago

print("platform.platform:", platform.platform())
platform.platform: Windows-10-10.0.22000-SP0 print("sys.maxsize > 232:", sys.maxsize > 232)
sys.maxsize > 2**32: True print("platform.python_version:", platform.python_version()) platform.python_version: 3.10.4 import cx_Oracle print("cx_Oracle.version:", cx_Oracle.version) cx_Oracle.version: 8.3.0 print("cx_Oracle.clientversion:", cx_Oracle.clientversion()) cx_Oracle.clientversion: (21, 3, 0, 0, 0) -->

  1. Is it an error or a hang or a crash?

I use wallet.sso and tcps, if host do not exists it hangs forever, is it possible to get a timeout. from time to time we reconfigure the host and then my programs hang indefinetely:

  1. What error(s) or behavior you are seeing?

indefinetely hang.

  1. Include a runnable Python script that shows the problem.
import cx_Oracle
dsn = "(DESCRIPTION=(FAILOVER=on)(LOAD_BALANCE=off)(CONNECT_TIMEOUT=15)(RETRY_COUNT=20)(RETRY_DELAY=3)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCPS)(HOST=xxxxxxxxxx)(PORT=2484)))(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCPS)(HOST=xxxxxxxxxxx)(PORT=2484)))(CONNECT_DATA=(SERVICE_NAME=pdb_xms_sz_qa4_RW)))"

con = cx_Oracle.connect(user='<oracle user>', password='t<oracle users password>', dsn=dsn)
cur = con.cursor()
dat = cur.execute("select count(*) from xms.cmscustomer")
for d in dat:
    print(d)

If the host is correct it works, but if it does not exists, it hangs forever, CONNECT_TIMEOUT=15 do not work.

cjbj commented 2 years ago

Try configuring your network and/or Oracle Net e.g. SQLNET.OUTBOUND_CONNECT_TIMEOUT or CONNECT_TIMEOUT. There are a few notes inhttps://cx-oracle.readthedocs.io/en/latest/user_guide/ha.html#network-configuration

If you have further problems, follow up with Oracle Support.

fenchu commented 2 years ago

Thanks setting the sqlnet.ora settings seem to work, but the ones set in the dsn they do not matter what they are.

WALLET_LOCATION = (SOURCE =
    (METHOD = FILE)
    (METHOD_DATA = (DIRECTORY = C:\\dist\\oracle\\instantclient_21_3\\network\\admin))
)
SQLNET.WALLET_OVERRIDE = TRUE
SSL_CLIENT_AUTHENTICATION = FALSE
SSL_VERSION = 0
SQLNET.INBOUND_CONNECT_TIMEOUT = 10
SQLNET.OUTBOUND_CONNECT_TIMEOUT = 10
SQLNET.CONNECT_TIMEOUT = 10

Thanks again.