Connection Exit Due to Improper Timeout Parameter Settings
Scenario
A database connection exit often occurs. As a result, subsequent statements fail to be executed.
Possible Causes
When a connector or API is used to connect to a database, the client has some default parameter settings. The settings of some important parameters, such as socketTimeout and connectTimeout, determine the client connection timeout duration. If the wait time of a connection exceeds the value of one of these parameters, the connection will be interrupted.
Solution
- Change the default values of parameters such as socketTimeout and connectTimeout to appropriate values.
- Pay attention to the reconnection function in the program.
- Using connection pools is recommended.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.