I have an API that connects with oracle database to execute a function and return value.. suddenly it doesn't work and throws exception "Connection Time out"
CodePudding user response:
Connection timeout is mostly due to firewall issues.
Go to the client machine (who complained) and open a command prompt and try telnet
c:> telnet <hostname.domain) (Port is the database port that your listener is listening on)
For ex,
c:> telnet prodhost.us.oracle.com 1521
and see if it talks. If it doesn't, something (firewall) must be broken since then
CodePudding user response:
connection timeout can also be caused by DB server being extremely busy , you can also try setting the sqlnet parameters to allow for longer connect times as per oracle document shown below :
Oracle Net Services - Version 11.2.0.1 and later Information in this document applies to any platform.Goal This document describes the following sqlnet.ora file parameters:
SQLNET.INBOUND_CONNECT_TIMEOUT=n SQLNET.OUTBOUND_CONNECT_TIMEOUT=n SQLNET.RECV_TIMEOUT=n SQLNET.SEND_TIMEOUT=n TCP.CONNECT_TIMEOUT=n
Note that each parameter is set in seconds.
The default for SQLNET.INBOUND_CONNECT_TIMEOUT is 60 seconds.
The default for TCP.CONNECT_TIMEOUT is also 60 seconds.
There is no default for the remaining parameters.
A setting of 0 for all the parameters above would mean the parameter is "disabled".
The SQLNET.INBOUND_CONNECT_TIMEOUT and SQLNET.OUTBOUND_CONNECT_TIMEOUT parameters are both "connect-time" parameters. If, during the connection phase, the authentication process isn't complete in the amount of time specified by these parameters, the connection will fail. SQLNET.INBOUND_CONNECT_TIMEOUT is strictly a server side parameter. SQLNET.OUTBOUND_CONNECT_TIMEOUT can be used at either client or server to limit the amount of time an outbound connection should be allowed.
The TCP.CONNECT_TIMEOUT controls the amount of time the client is allowed to establish the connection to the server at the TCP layer.
If for example , the resolution of the TCP address given to the client does not complete in the time allowed, the connection will fail with a timeout.Regarding SQLNET.RECV_TIMEOUT and SQLNET.SEND_TIMEOUT , we can have them both on client and server side. For example, if we have on the server side SQLNET.RECV_TIMEOUT=1 , it means that if the database doesn't receive a request, package exchange in 1 seconds from the client, the connection with that client is terminated,timeout. If SQLNET.SEND_TIMEOUT=1 and if the database cannot complete the send operation to the client in 1 second , the connection is timeout. For example, if the client shutdown abnormally and the information trying to be send by the database receive no answers for 1s , the operation is timeout.