odbccmpt Utility

Command Prompt Utilities

Command Prompt Utilities

odbccmpt Utility

The odbccmpt utility enables or disables the compatibility option for an ODBC application executable file.

Syntax

odbccmpt file_name [/v:version_number] [/P] [/T] [/R] [/d]

Arguments

file_name

Is the name of the application executable file for which the compatibility option is to be turned on/off. For example, if the full path and name of your executable file is C:\Winnt\System32\MyApp.exe, only specify MyApp. Do not enclose file_name in quotation marks.

Do not specify the name of the executable file for:

  • Any application in the Microsoft SQL Server 2000 program group.

  • Any SQL Server 2000 command prompt utility.

  • The SQL Server executable file, Sqlservr.exe.

/v:version_number

Specifies that the application should be run in 6.x or 7.0 compatibility mode. Allowable values for version_number are 6 and 7. Invoking this option requests the server to communicate with the application using a lower level protocol.

/P

Requires a connection peek call during SQL_ATTR_CONNECTION_DEAD. Excluding this option provides a small performance advantage for applications that use connection pooling.

/T

Specifies that translations be turned off in the specified application. This option provides backward compatibility with applications that use SQLDriverConnect and have no way to customize their connection properties.

/R

Specifies that the application should ignore calls for a connection reset. When a connection returns to the connection pool, the driver is called with SQL_COPT_SS_RESET. If this option is set, the application will ignore the call to reset the connection.

/d

Disables the specified option for specified application. For example, odbccmpt /P /d will disable connection peek.

Remarks

The 6.5/7.0 ODBC compatibility option sets certain behaviors of the 3.7 SQL Server ODBC driver to be compatible with earlier SQL Server ODBC drivers. This is only needed when using the 3.7 SQL Server ODBC driver and connecting to an instance of SQL Server 2000 using applications developed with earlier versions of the SQL Server ODBC driver. The 6.5/7.0 ODBC compatibility option can be turned on for applications using either the ODBC 2.x or ODBC 3.x API.

odbccmpt does not need to be run for applications connecting to earlier versions of SQL Server using the 3.7 SQL Server ODBC driver. The 3.7 driver automatically runs in compatibility mode when it connects to earlier versions of SQL Server. odbccmpt does not need to be run for applications using earlier versions of the SQL Server ODBC driver connecting to SQL Server 2000. SQL Server 2000 automatically treats any application using the earlier drivers as a 6.5 or 7.0-level application.

Enabling the 6.5 ODBC compatibility option for an application causes the application to be treated as a 6.5-level application. The setting enables these changes in the behavior of the 3.7 SQL Server ODBC driver when it connects to an instance of SQL Server 2000:

  • The driver exhibits SQL Server 6.5 behavior for SQLPrepare and SQLExecute. The driver does not use the prepare/execute support built into SQL Server 2000. The driver generates temporary stored procedures if the option to generate stored procedures for SQLPrepare is turned on.

  • The SET CONCAT_NULL_YIELDS_NULL option is turned off.

  • An input parameter can be bound as either SQL_PARAM_INPUT_OUTPUT or SQL_PARAM_OUTPUT with SQLBindParameter.

  • Result sets are returned by the driver in a format comparable to the result sets returned to a SQL Server 6.5 client:
    • Data from nchar and nvarchar columns are not treated as Unicode data. Instead, these columns are interpreted as character data using the Windows code page on the server running SQL Server. The ODBC catalog functions report nchar, nvarchar, and uniqueidentifier columns as char, varchar, and varbinary respectively.

    • Data cannot be retrieved from ntext columns.

    • nchar and nvarchar columns bound to SQL_C_DEFAULT return character data instead of Unicode data.

    • char, varchar, binary, and varbinary data values over 255 bytes are truncated to 255 bytes when they are returned to the application. nchar and nvarchar data values over 255 characters are truncated to 255 char or varchar characters.

    • Object names longer than 30 bytes are truncated to 30 bytes.

      This truncation may affect additional operations, such as preventing SQLSetPos updates referencing text and image columns.

    • Null values in bit columns are returned as 0.

      Catalog results show all bit columns as NOT NULL because bit columns did not support null values in SQL Server 6.5.

    • Data from uniqueidentifier columns is returned as varbinary data.

    • The final node in the version string returned by the SQL_DBMS_VER parameter of SQLGetInfo never exceeds 255, regardless of the actual version string returned from the instance of SQL Server the application is connected to.

    • The SQLGetInfo attributes reporting the data types supported by the driver do not report the new data types introduced after SQL Server 6.5.

If 7.0 compatibility is set, the server will communicate with the ODBC driver using 7.0 protocol. This means that the performance enhancements included in the prepare/execute model will not used. All new data types introduced with SQL Server 2000 (for example, sql_variant and bigint) will be converted to the closest matching type that the 7.0 driver supports.

The ODBC compatibility option can only be set at the level of an executable file. It cannot be set for individual DLLs.

When odbccmpt is run to enable the 6.5 ODBC compatibility option, it creates a registry key:

HKEY_LOCAL_MACHINE
   SOFTWARE   
      Microsoft
         MSSQLServer
            Client
               ODBCAppCompat
                  file_name:REG_SZ:6.5

When odbccmpt is run with the -d parameter, this key is removed. No error message is returned if odbccmpt is run with the -d parameter and there is no registry key for file_name.

Whenever the 3.7 SQL Server ODBC driver connects to SQL Server 2000, it checks the registry for a key matching the name of the executable file for the application. If a match is found, the driver enables the 6.5 ODBC compatibility option. If no match is made, the 6.5 ODBC compatibility option is not enabled.

Note  Most ODBC applications can switch without change from the 2.65 SQL Server ODBC driver to the 3.7 driver. odbccmpt is a migration aid to assist with moving applications from SQL Server 6.5 to SQL Server 2000. It should be used only for applications having problems in moving to SQL Server 2000 and the 3.7 SQL Server ODBC driver. odbccmpt should only be used until the application has been corrected.

For information about where to find or how to run this utility, see Getting Started with Command Prompt Utilities.

Examples
A. Enable the ODBC compatibility option
odbccmpt MyApp /T
odbccmpt MyApp /v:6
B. Disable the ODBC compatibility option
odbccmpt MyApp /T /d