SQLReleaseEnv - Release all environment resources
SQLReleaseEnv()
invalidates
and frees the environment handle. All Db2® for
i CLI resources associated
with the environment handle are freed.
SQLFreeConnect()
must
be called before calling this function.
This function is the last Db2 for i CLI step that an application needs to do before it ends.
Syntax
SQLRETURN SQLReleaseEnv (SQLHENV henv);
Function arguments
Data type | Argument | Use | Description |
---|---|---|---|
SQLHENV | henv | Input | Environment handle. |
Usage
If this function is called when there is still a valid connection handle, SQL_ERROR is returned, and the environment 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 | There is an hdbc which is in allocated or connected state. Call SQLDisconnect and SQLFreeConnect for the hdbc before calling SQLReleaseEnv. |
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 the SQLAllocEnv - Allocate environment handle.