DISCONECT
Function
Closes one or all database connections.
Syntax
DISCONNECT connection_name DISCONNECT [ CURRENT ] DISCONNECT DEFAULT DISCONNECT ALL
Parameter Description
- connection_name
Name of the database connection established by the CONNECT command.
- current
Closes the current connection, which can be a recently opened connection or a connection set by the SET CONNECTION command. This is also the default if no parameter is passed to the DISCONNECT command.
- default
Closes the default connection.
- all
Closes all open connections.
Example
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void)
{
/* Create the testdb database in advance. */
EXEC SQL CONNECT TO testdb AS DEFAULT USER testuser;
EXEC SQL CONNECT TO testdb AS con1 USER testuser;
EXEC SQL CONNECT TO testdb AS con2 USER testuser;
EXEC SQL CONNECT TO testdb AS con3 USER testuser;
EXEC SQL DISCONNECT CURRENT; /* Close connection 3. */
EXEC SQL DISCONNECT DEFAULT; /* Close the default connection. */
EXEC SQL DISCONNECT ALL; /* Close connections 2 and 1. */
return 0;
}
Helpful Links
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.