Question

If I try to establish a connection via PQconnectdb and it fails, is it ok to call PQreset on PGconn* to retry or does it only work if I've already been connected once?

Was it helpful?

Solution

If the connection attempt is failed because of some invalid connections options (error like invalid connection options) than calling the PQreset will also fail. But for cases where all arguments to the PQconnectdb were correct and connection was unsuccessful because of reasons like remote server was busy or not accepting the new connections than PQreset will work just fine.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top