问题
I tried setting oracle.net.READ_TIMEOUT as connection properties but it seems like it is not working,
however setting oracle.jdbc.ReadTimeout works. Any idea why? I am using 11g JDBC Drivers. And the DB server version is 11g.
回答1:
According to http://www.javamonamour.org/2012/09/oraclenetconnecttimeout.html
oracle.net.READ_TIMEOUTfor jdbc versions< 10.1.0.5oracle.jdbc.ReadTimeoutfor jdbc versions>=10.1.0.5
So if you are using a JDBC driver version 10.1.0.5 or higher, then oracle.jdbc.ReadTimeout is the correct property.
回答2:
try reading the Oracle Document "How to Ensure that JDBC Queries are Always Timed Out (Doc ID 559564.1)" They suggest using one of these properties:
for the Thin driver: oracle.net.ns.SQLnetDef.TCP_CONNTIMEOUT_STR
for the OCI driver: sqlnet.outbound_connection_timeout
I haven't tested myself so I cannot guarantee it actually solves the issue.
回答3:
Unfortunately that document requires an Oracle Support account to access.
来源:https://stackoverflow.com/questions/18511582/oracle-net-read-timeout-vs-oracle-jdbc-readtimeout