Closed zhaoya881010 closed 5 years ago
The test code shows a pretty good example, can change TestContextTimeout:
If you use a tnsnames.ora file, add CONNECT_TIMEOUT. The tnsname goes inside the openString instead of host.
MYDBNAME =
(DESCRIPTION =
(CONNECT_TIMEOUT = 55)
(ADDRESS = (PROTOCOL = TCP)(HOST = myhostname)(PORT = 1521))
)
Can also use a sqlnet.ora file instead and set SQLNET.OUTBOUND_CONNECT_TIMEOUT=55
in that file.
https://docs.oracle.com/cd/E11882_01/network.112/e10835/sqlnet.htm#NETRF427
You can now set some of these options via the Easy Connect syntax without needing a tnsnames.ora or sqlnet.ora. See https://docs.oracle.com/en/database/oracle/oracle-database/19/netag/configuring-naming-methods.html#GUID-8C85D289-6AF3-41BC-848B-BF39D32648BA
@cjbj i test use Easy Connect. command="system/oracle@host:1521/ora11g?connect_timeout=60&retry_count=1"
sql.Open() dp.ping()
i found timeout always "20s".
easy connect is oracle 19,i am 11.
Small correction: Easy Connect came in Oracle DB 10. Easy Connect Plus came in Oracle DB 19.
I do not think oci8 supports Easy Connect at this time. Feature request for that is probably needed.
@zhaoya881010 Did the tnsnames.ora or sqlnet.ora file change work fine?
@mattn Close this?
If set a error address, it will take a long time to return.how set connect timeout?