SQLGetConnectAttr - Get the value of a connection attribute

Purpose

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

These options are set using the SQLSetConnectAttr() function.

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 * sLen Output Length of the output data, if the attribute is a character string; otherwise, unused.
SQLINTEGER bLen Input Maximum number of bytes to store in pvParm, if the value is a character string; otherwise, unused.
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.

Usage

If SQLGetConnectAttr() is called, and the specified fAttr has not been set through SQLSetConnectAttr and does not have a default, then SQLGetConnectAttr() returns SQL_NO_DATA_FOUND.

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.