SQLConfigDataSource

ODBC and SQL Server

ODBC and SQL Server

SQLConfigDataSource

The Microsoft® SQL Server™ ODBC driver supports the following SQL Server-specific keyword/value pairs for data source configuration attribute strings.

Keyword Values Description
Address   Network address of the SQL Server.
AnsiNPW yes Default. Specifies that ANSI_NULLS, ANSI_WARNINGS, ANSI_PADDING, and CONCAT_NULL_YIELDS_NULL are set ON for each connection. This allows SQL Server to treat SQL statements as per SQL-92. For more information see Effects of SQL-92 Options.
  no Do not use ANSI-defined behaviors for NULL comparisons, padding, warnings, and NULL concatenation.
AttachDBFileName file_path Name of the primary file of an attachable database. Include the full path, and escape any \ characters if using a C character string variable:

AttachDBFileName=c:\\AB\\MyDB.mdf

This database is attached and becomes the default database for the connection. To use AttachDBFileName you must also specify the database name in either the SQLDriverConnnect DATABASE parameter or the SQL_COPT_CURRENT_CATALOG connection attribute. If the database was previously attached, SQL Server will not reattach it; it will use the attached database as the default for the connection.

AutoTranslate yes Default. ANSI character strings sent between the client and server are translated by converting through Unicode to minimize problems in matching extended characters between the code pages on the client and the server:

Client SQL_C_CHAR data sent to a SQL Server char, varchar, or text variable, parameter, or column is converted from character to Unicode using the client ANSI code page (ACP), then converted from Unicode to character using the ACP of the server.

SQL Server char, varchar, or text data sent to a client SQL_C_CHAR variable is converted from character to Unicode using the server ACP, then converted from Unicode to character using the client ACP.

These conversions are performed on the client by the SQL Server ODBC driver. This requires that the same ANSI code page (ACP) used on the server be available on the client.

These settings have no effect on the conversions that occur for these transfers:

Unicode SQL_C_WCHAR client data sent to char, varchar, or text on the server.

char, varchar, or text server data sent to a Unicode SQL_C_WCHAR variable on the client.

ANSI SQL_C_CHAR client data sent to Unicode nchar, nvarchar, or ntext on the server.

Unicode char, varchar, or text server data sent to an ANSI SQL_C_CHAR variable on the client.

  no Do not perform character translation.

The SQL Server ODBC driver does not translate client ANSI character data sent to char, varchar, or text variables, parameters, or columns on the server. No translation is performed on char, varchar, or text data sent from the server to character variables on the client.

If the client and SQL Server installation are using different ACPs, then extended characters can be misinterpreted.

Database   Name of the default database for the connection. If Database is not specified, the default database defined for the login is used. The default database from the ODBC data source overrides the default database defined for the login. If AttachDBFileName points to a primary database file, the database is attached and given the name specified in Database.
Description   Descriptive text. The description appears with the data source in the ODBC Management utility.
Driver {SQL Server} Driver name. The braces are required when using version 2.65 or earlier of the SQL Server ODBC driver.
Fallback
(SQL Server 6.5 only)
yes Fallback connection attempts are made if a connection to the primary server fails. Available only when connecting to an instance of SQL Server 6.5.
  no Default. Fallback connection attempts are not made.
Language   SQL Server language name. SQL Server can store messages for multiple languages in sysmessages. If connecting to a SQL Server with multiple languages, Language specifies which set of messages are used for the connection.
Network   Name of a Net-Library dynamic-link library. The name need not include the path and must not include the .dll file name extension, for example, Network=dbnmpntw.
QueryLog_On yes Enables logging of long-running queries.
  no Default. Disables logging of long-running queries.
QueryLogFile   Full path and name of the file used to log long-running queries.
QueryLogTime   Digit character string specifying the threshold (in milliseconds) for logging long-running queries. Any query that does not get a response in the time specified is written to the long-running query log file.
QuotedId yes Default. Specifies that QUOTED_IDENTIFIERS is set ON for each connection, SQL Server uses the SQL-92 rules regarding the use of quotation marks in SQL statements. For more information, see Effects of SQL-92 Options.
  no Specifies that QUOTED_IDENTIFIERS is set OFF for each connection. SQL Server then follows the legacy Transact-SQL rules regarding the use of quotation marks in SQL statements.
Regional yes Respect client workstation settings for region when converting date, time, and currency values to character strings. This setting should only be specified for applications that only display data, not for applications that process data.
  no Default. Use ODBC-defined character formats for date, time, and money conversion.
Server   Name of a server running SQL Server on the network. The value must be either the name of a server on the network, or the name of a SQL Server Client Network Utility advanced server entry. You can enter (local) as the server name on Windows NT 4.0 to connect to a copy of SQL Server running on the same computer. SQL Server 2000 supports multiple instances of SQL Server running on the same computer. To specify a named instance of SQL Server, the server name is specified as ServerName\InstanceName. For more information about server names, see Managing Clients.
StatsLog_On yes Enables driver performance logging.
  no Default. Disables driver performance logging.
StatsLogFile   Full path and name of the file used to record SQL Server ODBC driver performance statistics.
Trusted_Connection yes Windows Authentication is enabled for the data source.
  no Default. SQL Server Authentication is enabled for the data source. A SQL Server login and password must be specified for each connection.
UseProcForPrepare 0 Temporary stored procedures are not created on statement preparation.
(SQL Server 6.5 or earlier only) 1 Default. Temporary stored procedures are created for prepared SQL statements. The procedures are dropped when the connection is closed or lost.
  2 Temporary stored procedures are created for prepared SQL statements. The procedures are dropped when the cursor is closed.

Note  Regional conversion settings apply to currency, numeric, date, and time data types. The conversion setting is only applicable to output conversion and is only visible when currency, numeric, date, or time values are converted to character strings.

The driver uses the locale registry settings for the current user. The driver does not honor the current thread's locale if the application sets it after connection by, for example, calling SetThreadLocale.

Altering the regional behavior of a data source can cause application failure. An application that parses date strings, and expects date strings to appear as defined by ODBC, could be adversely affected by altering this value.