RE: How to retrieve the current ODBC settings from a connection?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi Ming,

I have tried using SQLGetConnectAttr based on the link below but the value
returned is 4128768 or 4128769.

http://msdn2.microsoft.com/en-us/library/aa177892(SQL.80).aspx

One thing I noticed is that the Odbcss.h file in my machine does not have
those SQL_AD_ON, SQL_AD_OFF, SQL_QI_OFF, SQL_QI_ON, SQL_XL_OFF, and SQL_XL_ON.

I find a different copy of ODBCSS.h in internet and it has this:

// Defines for use with SQL_COPT_SS_QUOTED_IDENT
#define SQL_QI_OFF 0L // Quoted identifiers are enable
#define SQL_QI_ON 1L // Quoted identifiers are disabled
#define SQL_QI_DEFAULT SQL_QI_ON

// Defines for use with SQL_COPT_SS_ANSI_NPW - Pre-Connect Option only
#define SQL_AD_OFF 0L // ANSI NULLs, Padding and Warnings are enabled
#define SQL_AD_ON 1L // ANSI NULLs, Padding and Warnings are disabled
#define SQL_AD_DEFAULT SQL_AD_ON

// Defines for use with SQL_COPT_SS_TRANSLATE
#define SQL_XL_OFF 0L // Code page translation is not performed
#define SQL_XL_ON 1L // Code page translation is performed
#define SQL_XL_DEFAULT SQL_XL_ON

What do 0L and 1L mean?

Peter


"Pak-Ming Cheung [MSFT]" wrote:

You may use the function SQLGetConnectAttr to get the option setting. See
http://msdn2.microsoft.com/en-us/library/ms130916.aspx for detail. It should
work on both SNAC and sqlsrv32 driver.

AutoTranslate: SQL_COPT_SS_TRANSLATE
Regional: SQL_SOPT_SS_REGIONALIZE
AnsiNPW: SQL_COPT_SS_ANSI_NPW
QuotedID: SQL_COPT_SS_QUOTED_IDENT
Trusted_Connection: SQL_COPT_SS_INTEGRATED_SECURITY


Ming.
MDAC Team, Microsoft.


"Peter" wrote:

I want to get the current ODBC settings of in a connection which is using SQL
Server ODBC driver. I want to know the current settings of the following
attributes:

AutoTranslate
Regional
AnsiNPW
QuotedID
Trusted_Connection

Which ODBC API functions I can use to retrieve those attributes?


.