]> begriffs open source - ai-pg/blob - full-docs/txt/ecpg-sql-disconnect.txt
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / txt / ecpg-sql-disconnect.txt
1
2 DISCONNECT
3
4    DISCONNECT — terminate a database connection
5
6 Synopsis
7
8 DISCONNECT connection_name
9 DISCONNECT [ CURRENT ]
10 DISCONNECT ALL
11
12 Description
13
14    DISCONNECT closes a connection (or all connections) to the database.
15
16 Parameters
17
18    connection_name #
19           A database connection name established by the CONNECT command.
20
21    CURRENT #
22           Close the “current” connection, which is either the most
23           recently opened connection, or the connection set by the SET
24           CONNECTION command. This is also the default if no argument is
25           given to the DISCONNECT command.
26
27    ALL #
28           Close all open connections.
29
30 Examples
31
32 int
33 main(void)
34 {
35     EXEC SQL CONNECT TO testdb AS con1 USER testuser;
36     EXEC SQL CONNECT TO testdb AS con2 USER testuser;
37     EXEC SQL CONNECT TO testdb AS con3 USER testuser;
38
39     EXEC SQL DISCONNECT CURRENT;  /* close con3          */
40     EXEC SQL DISCONNECT ALL;      /* close con2 and con1 */
41
42     return 0;
43 }
44
45 Compatibility
46
47    DISCONNECT is specified in the SQL standard.
48
49 See Also
50
51    CONNECT, SET CONNECTION