JDBC Error Occurs Due to session_timeout Settings
Symptom
org.postgresql.util.PSQLException: Database connection failed when starting copy at org.postgresql.core.v3.QueryExecutorImpl.startCopy(QueryExecutorImpl.java:804) at org.postgresql.copy.CopyManager.copyIn(CopyManager.java:52) at org.postgresql.copy.CopyManager.copyIn(CopyManager.java:161) at org.postgresql.copy.CopyManager.copyIn(CopyManager.java:146) at copy.main(copy.java:95) Caused by: java.io.EOFExceptionat org.postgresql.core.PGStream.ReceiveChar(PGStream.java:284) at org.postgresql.core.v3.QueryExecutorImpl.processCopyResults(QueryExecutorImpl.java:1008) at org.postgresql.core.v3.QueryExecutorImpl.startCopy(QueryExecutorImpl.java:802) ... 4 more
Possible Causes
session_timeout is set to 10min by default. That is, a database is automatically disconnected if the connection is idle for more than 10 minutes.
Handling Procedure
Log in to the GaussDB(DWS) management console and set session_timeout to 0 or a long duration to ensure the session can stay connected for a long time.
- Log in to the GaussDB(DWS) management console. In the cluster list, find the target cluster and click the cluster name. The Cluster Information page is displayed.
- Click the Parameter Modifications tab and modify the value of parameter session_timeout. Click Save.
After the COPY import is complete, you are advised to set session_timeout to 10 minutes. A client connected to the database creates a thread. If the client does not perform any operation on the database for a long time, the thread is idle. If there are a large number of such clients, the connection resources will be wasted.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot