SQLSetConnectOption - Set connection option
SQLSetConnectOption() has been deprecated and replaced with SQLSetConnectAttr(). Although this version of DB2® for i CLI continues to support SQLSetConnectOption(), it is recommended that you begin using SQLSetConnectAttr() in your DB2 for i CLI programs so that they conform to the latest standards.
SQLSetConnectOption() sets connection attributes for a particular connection.
Syntax
SQLRETURN SQLSetConnectOption (SQLHDBC hdbc,
SQLSMALLINT fOption,
SQLPOINTER vParam);
Function arguments
Data type | Argument | Use | Description |
---|---|---|---|
SQLHDBC | hdbc | Input | Connection handle. |
SQLSMALLINT | fOption | Input | Connect option to set, refer to Table 2 for more information. |
SQLPOINTER | vParam | Input | Value associated with fOption. Depending on the option, this can be a pointer to a 32-bit integer value, or a character string. |
Usage
The SQLSetConnectOption() provides many of the same attribute functions as SQLSetConnectAttr() before V5R3. However, SQLSetConnectOption() has since been deprecated, and support for all new attribute functions has gone into SQLSetConnectAttr(). Users should migrate to the nondeprecated interface.
All connection and statement options set through the SQLSetConnectOption() persist until SQLFreeConnect() is called or the next SQLSetConnectOption() call.
The format of information set through vParam depends on the specified fOption. The option information can be either a 32-bit integer or a pointer to a null-terminated character string.
Refer to Table 2 for the appropriate connect options.
Return codes
- SQL_SUCCESS
- SQL_SUCCESS_WITH_INFO
- SQL_ERROR
- SQL_INVALID_HANDLE
Diagnostics
SQLSTATE | Description | Explanation |
---|---|---|
HY001 | Memory allocation failure | The driver is unable to allocate memory required to support the processing or completion of the function. |
HY009 | Argument value that is not valid | Given the fOption value, a
value that is not valid is specified for the argument vParam.
A fOption value that is not valid is specified. |
HYC00 | Driver not capable | The specified fOption is
not supported by DB2 for
i CLI
or the data source. Given the specified fOptionvalue, the value specified for the argument vParam is not supported. |