Closing a Connection
libpq usually uses the function PQfinish to close the connection to the database. If your application has established multiple connections, make sure that each connection is closed correctly.
The following is an example (for details about the complete example, see Establishing a Database Connection, Executing SQL Statements, and Returning Results).
/* Close the portal. We do not need to check for errors. */ res = PQexec(conn, "CLOSE myportal"); PQclear(res); /* End the transaction. */ res = PQexec(conn, "END"); PQclear(res); /* Close the database connection and clean up the database. */ PQfinish(conn);
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