SQLGetConnectOption - Return current setting of a connect Option

Purpose

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

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

These options are set using the SQLSetConnectOption() function.

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.
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).
SQLSMALLINT fOption Input Option to retrieve. Refer to Table 2 for more information.

Usage

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

If SQLGetConnectOption() is called, and the specified fOption has not been set through SQLSetConnectOption and does not have a default, then SQLGetConnectOption() returns SQL_NO_DATA_FOUND.

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.