バージョンごとのドキュメント一覧

DISCONNECT

DISCONNECT <refpurpose>terminate a database connection</refpurpose> — データベース接続を終了します。

概要

DISCONNECT connection_name
DISCONNECT [ CURRENT ]
DISCONNECT DEFAULT
DISCONNECT ALL

説明

<title>Description</title>

<command>DISCONNECT</command> closes a connection (or all connections) to the database. DISCONNECTはデータベースとの接続(またはすべての接続)を閉ざします。

パラメータ

<title>Parameters</title>
connection_name #

A database connection name established by the <command>CONNECT</command> command. CONNECTコマンドで確立したデータベース接続の名前です。

CURRENT #

Close the <quote>current</quote> connection, which is either the most recently opened connection, or the connection set by the <command>SET CONNECTION</command> command. This is also the default if no argument is given to the <command>DISCONNECT</command> command. 直前に開いた接続またはSET CONNECTIONコマンドで設定された接続のいずれかである、現在の接続を閉ざします。 これはDISCONNECTに引数が与えられなかった場合のデフォルトです。

DEFAULT #

Close the default connection. デフォルトの接続を閉ざします。

ALL #

Close all open connections. 開いているすべての接続を閉じます。

<title>Examples</title>
int
main(void)
{
    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 con3          */
    EXEC SQL DISCONNECT DEFAULT;  /* close DEFAULT       */
    EXEC SQL DISCONNECT ALL;      /* close con2 and con1 */

    EXEC SQL DISCONNECT CURRENT;  /* con3を閉じる       */
    EXEC SQL DISCONNECT DEFAULT;  /* DEFAULTを閉じる    */
    EXEC SQL DISCONNECT ALL;      /* con2とcon1を閉じる */

    return 0;
}

互換性

<title>Compatibility</title>

<command>DISCONNECT</command> is specified in the SQL standard. DISCONNECTは標準SQLで規定されています。

関連項目

<title>See Also</title> CONNECT, SET CONNECTION