Version: 7.0.0

SQLFreeHandle ​

Description ​

Frees an environment, connection, or statement handle. It can replace SQLFreeEnv, SQLFreeConnect, and SQLFreeStmt.

Prototype ​

c
SQLRETURN SQLFreeHandle(SQLSMALLINT   HandleType,    
                        SQLHANDLE     Handle);

Parameters ​

Table 1 SQLFreeHandle parameters

Keyword

Parameter description

HandleType

Type of handles to be freed by SQLFreeHandle. It must be one of the following values:

  • SQL_HANDLE_ENV
  • SQL_HANDLE_DBC
  • SQL_HANDLE_STMT

For other values, SQLFreeHandle returns SQL_ERROR.

Handle

Handle to be freed.

Return Values ​

  • SQL_SUCCESS: The call is successful.

  • SQL_SUCCESS_WITH_INFO: Some warning information is present.

  • SQL_ERROR: Execution failed, and the handle was not freed.

  • SQL_INVALID_HANDLE: The input handle is invalid.

NOTE ​

If SQLFreeHandle returns SQL_ERROR, the handle remains valid.

Example ​

See: Example