Driver-specific Connection Options

The ODBC SQL Server driver supports the following driver-specific connection options for SQLSetConnectOption and SQLGetConnectOption.

Option Description
SQL_COPT_SS_ANSI_OEM SQL_AO_OFF. ANSI to OEM and OEM to ANSI translation is not performed. (Default.)

SQL_AO_ON. ANSI to OEM and OEM to ANSI translation is performed.

(Similar to dbsetopt and dbclropt using DBANSItoOEM | DBOEMtoANSI.)

SQL_COPT_SS_CONNECTION
_DEAD
(SQLGetConnectOption only)
SQL_CD_TRUE. The connection has been broken and is dead.

SQL_CD_FALSE. The connection is active and available.

(Similar to dbdead.)

SQL_COPT_SS_ENLIST_IN_DTC The MS DTC OLE transaction object that specifies the transaction to export to SQL Server. The client calls the MS DTC OLE ITransactionDispenser::BeginTransaction method to begin an MS DTC transaction and create an MS DTC transaction object that represents the transaction. The application then calls the SQLSetConnectOption function with the SQL_COPT_SS_ENLIST_IN_DTC option to associate the transaction object with the ODBC connection. All related database activity will be performed under the protection of the MS DTC transaction.

SQL_DTC_DONE. Ends an MS DTC association with an ODBC connection. The application can then use the same ODBC connection for a local SQL Server transaction.

(For more information, see the Guide to Microsoft Distributed Transaction Coordinator.)

SQL_COPT_SS_ENLIST_IN_XA To begin an XA transaction with an XA-compliant Transaction Processor (TP), the client calls the X/Open tx_begin function. The application then calls the SQLSetConnectOption function with a SQL_COPT_SS_ENLIST_IN_XA parameter of TRUE to associate the XA transaction with the ODBC connection. All related database activity will be performed under the protection of the XA transaction.

To end an XA association with an ODBC connection, the client must call the SQLSetConnectOption function with a SQL_COPT_SS_ENLIST_IN_XA parameter of FALSE. The application can then use the same ODBC connection for a local SQL Server transaction.

(For more information, see the Guide to Microsoft Distributed Transaction Coordinator.)

SQL_COPT_SS_PERF_DATA
(SQLGetConnectOption only)
The address of a pointer to a SQLPERF structure. The SQL Server driver will return a pointer to a SQLPERF structure that contains current performance data. If NULL returned, logging of performance data is not enabled.
SQL_COPT_SS_PERF_DATA
(SQLSetConnectOption only)
SQL_PERF_START. Start logging performance data.

SQL_PERF_STOP. Stop logging performance data.

SQL_COPT_SS_PERF_DATA_LOG Full path and filename of the performance data log file.
SQL_COPT_SS_PERF_DATA_LOG
_NOW
(SQLSetConnectOption only)
Writes a tab-delimited record of performance data to the specified log file. The vParam parameter can point to a null-terminated character string that contains a comment for this log record.
SQL_COPT_SS_PERF_QUERY
(SQLGetConnectOption only)
If NULL is returned, logging of long-running queries is not enabled. Otherwise, logging of long-running queries is enabled.
SQL_COPT_SS_PERF_QUERY
(SQLSetConnectOption only)
SQL_PERF_START. Start logging long-running queries.

SQL_PERF_STOP. Stop logging long-running queries.

SQL_COPT_SS_PERF_QUERY
_INTERVAL
The threshold value in milliseconds for logging of long-running queries. A query that takes longer than this number of milliseconds to run is logged.
SQL_COPT_SS_PERF_QUERY_LOG Full path and filename of the log file for long-running queries.
SQL_COPT_SS_USER_DATA Sets or gets the user data pointer.

If not set, SQLGetConnectOption returns SQL_UD_NOTSET.

(Similar to dbsetuserdata and dbgetuserdata.)

SQL_FALLBACK_CONNECT SQL_FALLBACK_CONNECT_OFF. Fallback server support is disabled. (Default)

SQL_FALLBACK_CONNECT_ON. When successfully connected to the primary server, the ODBC SQL Server driver automatically determines the current fallback server and verifies that fallback information is stored in the registry. If an attempt to connect to a primary server fails (the connection timeout must be greater than 0 for this to occur), the ODBC SQL Server driver will attempt to connect to the fallback server. This option must be set before calling SQLConnect, SQLDriverConnect, or SQLBrowseConnect.

SQL_INTEGRATED_SECURITY SQL_IS_OFF. Request a normal connection to SQL Server. A trusted connection using SQL Server integrated security is not requested. (Default)

SQL_IS_ON. Request a trusted connection to SQL Server regardless of the security mode of the server.

For information about the SQL Server login security mode and trusted connections, see the Microsoft SQL Server Administrator's Companion.

SQL_PRESERVE_CURSORS SQL_PC_OFF. All cursors are closed on SQLTransact. (Default)

SQL_PC_ON. Server cursors remain open on SQLTransact.

SQL_USE_PROCEDURE
_FOR_PREPARE
SQL_UP_ON. Temporary stored procedures are generated for SQLPrepare. (Default)

SQL_UP_OFF. Temporary stored procedures are not generated for SQLPrepare. The statement is stored, compiled, and run at execution time. All syntax error checking is delayed until execution time.

SQL_UP_ON_DROP. Temporary stored procedures are explicitly dropped on a subsequent call to SQLPrepare or when an hstmt is freed.