The SQL Server Native Client ODBC driver defines driver-specific connection attributes. Some of the attributes are available to SQLGetConnectAttr, and the function is used to report their current settings. The values reported for these attributes are not guaranteed until after a connection has been made or the attribute has been set using SQLSetConnectAttr.

For more information about attributes, see SQLSetConnectAttr.


The SQL_COPT_SS_CONNECTION_DEAD attribute reports the state of a connection to a server. The driver queries the network for the current state of the connection.


The standard ODBC connection attribute SQL_ATTR_CONNECTION_DEAD returns the most recent state of the connection. This might not be the current connection state.




The connection to the server has been lost.


The connection is open and available for statement processing.


The SQL_COPT_SS_PERF_DATA attribute returns a pointer to a SQLPERF structure containing the current driver performance statistics. SQLGetConnectAttr will return NULL if performance logging is not enabled. The statistics in the SQLPERF structure are not dynamically updated by the driver. Call SQLGetConnectAttr each time the performance statistics need to be refreshed.




Performance logging is not enabled.

Any other value

A pointer to a SQLPERF structure.


The SQL_COPT_SS_PERF_QUERY attribute returns TRUE if logging of long running queries is enabled. The request returns FALSE if query logging is not active.


The SQL_COPT_SS_USER_DATA attribute retrieves the user-data pointer. User data is stored in client-owned memory and recorded per connection. If the user-data pointer has not been set, SQL_UD_NOTSET, a NULL pointer, is returned.




No user-data pointer is set.

Any other value

A pointer to the user data.

SQLGetConnectAttr Support for Service Principal Names (SPNs)

SQLGetConnectAttr can be used to query the value of the new connection attributes SQL_COPT_SS_SERVER_SPN, SQL_COPT_SS_FAILOVER_PARTNER_SPN, SQL_COPT_SS_MUTUALLY_AUTHENTICATED, and SQL_COPT_SS_INTEGRATED_AUTHENTICATION_METHOD. (SQLGetConnectOption can also be used to query these values.)

SQL_COPT_SS_INTEGRATED_AUTHENTICATION_METHOD is only available for open connections that use Windows Authentication.

If SQL_COPT_SS_SERVER_SPN or SQL_COPT_SS_FAILOVER_PARTNER has not been set, the default value (an empty string) is returned.

For more information about SPNs, see Service Principal Names (SPNs) in Client Connections (ODBC).