SQLFreeEnv() invalidates and frees the environment handle. All DB2® UDB CLI resources associated with the environment handle are freed.
SQLFreeConnect() must be called before calling this function.
This function is the last DB2 UDB CLI step an application needs before terminating.
SQLRETURN SQLFreeEnv (SQLHENV henv);
Data type | Argument | Use | Description |
---|---|---|---|
SQLHENV | henv | Input | Environment handle |
If this function is called when there is still a valid connection handle, SQL_ERROR is returned, and the environment handle remains valid.
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 | There is an hdbc which is in allocated or connected state. Call SQLDisconnect and SQLFreeConnect for the hdbc before calling SQLFreeEnv. |
HY013 * | Memory management problem | The driver is unable to access memory required to support the processing or completion of the function. |
Refer to the example in SQLAllocEnv().