SQLFreeConnect - Free connection handle
SQLFreeConnect() invalidates and frees the connection handle. All DB2® for i CLI resources associated with the connection handle are freed.
SQLDisconnect() must be called before calling this function.
Either SQLFreeEnv() is called next to continue ending the application, or SQLAllocHandle() is called to allocate a new connection handle.
Syntax
SQLRETURN SQLFreeConnect (SQLHDBC hdbc);
Function 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.
Return codes
- SQL_SUCCESS
- SQL_ERROR
- SQL_INVALID_HANDLE
Diagnostics
SQLSTATE | Description | Explanation |
---|---|---|
58004 | System error | Unrecoverable system error. |
HY001 | Memory allocation failure | The driver is unable to allocate memory required to support the processing or completion of the function. |
HY010 | Function sequence error | The function is called before SQLDisconnect() for the hdbc. |
HY013 * | Memory management problem | The driver is unable to access memory required to support the processing or completion of the function. |
Example
Refer to the example in SQLAllocEnv - Allocate environment handle.