SQLGetConnectOption - Return current setting of a connect option

SQLGetConnectOption() has been deprecated and replaced with SQLGetConnectAttr(). Although this version of DB2® for i CLI continues to support SQLGetConnectOption(), it is recommended that you begin using SQLGetConnectAttr() in your DB2 for i CLI programs so that they conform to the latest standards.

SQLGetConnectOption() returns the current settings for the specified connection option.

These options are set using the SQLSetConnectOption() function.

Unicode (UTF-16) equivalent: This function can also be used with the Unicode (UTF-16) character set. The corresponding Unicode function is SQLGetConnectOptionW(). Refer to Unicode in DB2 for iCLI for more information about Unicode support for DB2 CLI.

Syntax

SQLRETURN SQLGetConnectOption( HDBC         hdbc,
                               SQLSMALLINT  fOption,
                               SQLPOINTER   pvParam);

Function arguments

Table 1. SQLGetConnectOption arguments
Data type argument Use Description
HDBC hdbc Input Connection handle.
SQLSMALLINT fOption Input Option to retrieve. Refer to Table 2 for more information.
SQLPOINTER pvParam Output Value associated with fOption Depending on the value of fOption, this can be a 32-bit integer value, or a pointer to a null terminated character string. The maximum length of any character string returned is SQL_MAX_OPTION_STRING_LENGTH bytes (excluding the null-terminating byte).

Usage

SQLGetConnectOption() provides the same function as SQLGetConnectAttr(). Both functions are supported for compatibility reasons.

Statement options settings cannot be retrieved through SQLGetConnectOption().

Diagnostics

Table 2. SQLGetConnectOption SQLSTATEs
SQLSTATE Description Explanation
08003 Connection not open An fOption value that requires an open connection is specified .
HY001 Memory allocation failure The driver is unable to allocate memory required to support the processing or completion of the function.
HY009 Option type out of range An fOption value that is not valid is specified.

The argument pvParam is a null pointer.

HYC00 Driver not capable The fOption argument is recognized, but is not supported.