Call Level Interface Guide and Reference

SQLFreeConnect - Free Connection Handle

Status of this Function since DB2 CLI Version 5
Note:

In ODBC version 3, SQLFreeConnect() has been deprecated and replaced with SQLFreeHandle(); see SQLFreeHandle - Free Handle Resources for more information.

Although this version of DB2 CLI continues to support SQLFreeConnect(), we recommend that you begin using SQLFreeHandle() in your DB2 CLI programs so that they conform to the latest standards.

See DB2 CLI Functions Deprecated for Version 5 for more information on this and other deprecated functions.

Migrating to the New Function

The statement:

   SQLFreeConnect(hdbc);
for example, would be rewritten using the new function as:
   SQLFreeHandle(SQL_HANDLE_DBC, hdbc);

Purpose
Specification: DB2 CLI 1.1 ODBC 1.0 ISO CLI

SQLFreeConnect() invalidates and frees the connection handle. All DB2 CLI resources associated with the connection handle are freed.

SQLDisconnect() must be called before calling this function.

Syntax

SQLRETURN   SQLFreeConnect   (SQLHDBC           hdbc);

Function Arguments

Table 82. SQLFreeConnect Arguments
Data Type Argument Use Description
SQLHDBC hdbc input Connection handle

Usage

If this function is called when a connection still exists, SQL_ERROR is returned, and the connection handle remains valid.

To continue termination, call SQLFreeEnv(), or, if a new connection handle is required, call SQLAllocConnect().

Return Codes

Diagnostics

Table 83. SQLFreeConnect SQLSTATEs
SQLSTATE Description Explanation
58004 Unexpected system failure. Unrecoverable system error.
HY001 Memory allocation failure. DB2 CLI is unable to allocate memory required to support execution or completion of the function.
HY010 Function sequence error. The function was called prior to SQLDisconnect() for the hdbc.
HY013 Unexpected memory handling error. DB2 CLI was unable to access memory required to support execution or completion of the function.

Restrictions

None.

Example

Refer to SQLFreeHandle - Free Handle Resources.

References


[ Top of Page | Previous Page | Next Page ]