Skip to content

SQLDisconnect

SQLDisconnect#

SQLDisconnect colses a connection and releases the handles for the connection.

Syntax#

SQLRETURN  SQLDisconnect (
    SQLHDBC     dbc );

Argument#

Data Type Argument In/Ouput Description
SQLHDBC dbc Input Connection handler

Return Values#

SQL_SUCCESS
SQL_SUCCESS_WITH_INFO
SQL_INVALID_HANDLE
SQL_ERROR

Description#

If an application calls SQLDisconnect() before releasing the statement handles related to the connection, the connection with the database will be closed.

When SQL_SUCCESS_WITH_INFO is returned, it means that database is successfully disconnected but additional errors or specified implementation program data exist. The cases are as follows:

An error occurred after disconnection. When connection is not established due to other problems such as communication failure.

An application can use the databasec to request another SQLConnect() after successfully calling SQLDisconnect().

To connect another database after calling this function, call SQLConnect() or SQLDriverConnect().

Diagnosis#

SQLSTATE Description Comments
HY000 General error
SQLAllocHandle
SQLConnect
SQLDriverConnect
SQLEndTran
SQLFreeConnect

Example#

< Refer to: $ALTIBASE_HOME/sample/SQLCLI/demo_ex1.cpp >

SQLDisconnect( dbc );