SQLGetConnectAttr - Get the value of a connection attribute

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

These options are set using the SQLSetConnectAttr() function.

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

Syntax

SQLRETURN SQLGetConnectAttr(   SQLHDBC      hdbc,
                               SQLINTEGER   fAttr,
                               SQLPOINTER   pvParam),;
                               SQLINTEGER   bLen,
                               SQLINTEGER   *sLen);

Function arguments

Table 1. SQLGetConnectAttr arguments
Data type Argument Use Description
SQLHDBC hdbc Input Connection handle.
SQLINTEGER fAttr Input Attribute to retrieve. See SQLSetConnectAttr - Set a connection attribute for a description of the connect options.
SQLPOINTER pvParam Output Value associated with fAttr Depending on the value of fAttr. This can be a 32-bit integer value, or a pointer to a null terminated character string.
SQLINTEGER bLen Input Maximum number of bytes to store in pvParm, if the value is a character string; otherwise, unused.
SQLINTEGER * sLen Output Length of the output data, if the attribute is a character string; otherwise, unused.

Usage

Statement options settings cannot be retrieved through SQLGetConnectAttr().

Diagnostics

Table 2. SQLGetConnectAttr SQLSTATEs
SQLSTATE Description Explanation
08003 Connection not open An fAttr 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 Attribute type out of range An fAttr value that is not valid is specified.

The argument pvParam is a null pointer.

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