SQLSetConnectOption - Set connection option
SQLSetConnectOption() has been deprecated and replaced with SQLSetConnectAttr(). Although this version of DB2® UDB CLI continues to support SQLSetConnectOption(), it is recommended that you begin using SQLSetConnectAttr() in your DB2 UDB 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
Table 1. SQLSetConnectOption 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() prior to 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.
Because SQLSetConnectOption() has been deprecated, not all the options listed in the table are supported.
Return codes
- SQL_SUCCESS
- SQL_SUCCESS_WITH_INFO
- SQL_ERROR
- SQL_INVALID_HANDLE
Diagnostics
Table 2. SQLSetConnectOption SQLSTATEs 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 UDB CLI or the data source. Given the specified fOptionvalue, the value specified for the argument vParam is not supported.
References
SQLSetConnectAttr - Set a connection attribute
Parent topic:
DB2 UDB CLI functions