PRB: File DSN and DSN-Less Connections May Fail with Localized ODBC

Article translations Article translations
Article ID: 174655 - View products that this article applies to.
This article was previously published under Q174655
Expand all | Collapse all

SYMPTOMS

When shareable file Data Source Name (DSN) or DSN-less connections are used on computers with localized Open Database Connectivity (ODBC) driver descriptions, the connection may fail with the following message:
IM002: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

CAUSE

Shareable file DSN and DSN-less connections use the DRIVER keyword to indicate which ODBC driver to use. The DRIVER keyword is set to a driver description that must match the description of an installed driver on the client computer. On computers with localized ODBC driver descriptions, the description used in the file DSN or DSN-less connection may not match that of the installed driver, thereby causing the error message described above.

For example, if the German version of Microsoft Office 97 installed the ODBC Access 97 driver with a description of "Microsoft Access-Treiber (*.mdb)," a file DSN or a DSN-less connection containing "DRIVER={Microsoft Access Driver (*.mdb)}" will fail, even though the Access driver has been installed properly.

WORKAROUND

To work around this problem, do either of the following:

  • Change the driver description used in the file DSN or DSN-less connection so that it matches the one on the client computer.

    -or-
  • Install the driver again on the client computer with the description used in the connect string. Note that using this option will result in more than one description for the same driver, which will allow any program using any one of the localized descriptions to connect through the driver on the client.
The following ODBC 3.0 sample code illustrates a minimal installation of the ODBC SQL Server driver with an English driver description. You can alter the code to install any ODBC driver with any driver description. For more information concerning the files and function calls used in the code, see the ODBC 3.0 SDK.

   #include <windows.h>
   #include <stdio.h>
   #include <odbcinst.h>

   void ShowErrors ()
   {
      WORD     iError = 1;
      DWORD pfErrorCode;
      char     lpszErrorMsg[301];
      WORD     cbErrorMsgMax = 300;
      RETCODE  rc;

      while (SQL_NO_DATA != (rc = SQLInstallerError(
               iError ++,
               & pfErrorCode,
               lpszErrorMsg,
               cbErrorMsgMax,
               NULL )))
         if (rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO)
            printf( "%s\n", lpszErrorMsg);

      printf ("\n");
   }


   void main ()
   {
      char *    szDriver = "SQL
   Server\0Driver=sqlsrv32.dll\0Setup=sqlsrv32.dll\0\0";
      char *    szPathIn = "c:\\winnt\\system32";
      char   szPathOut[301];
      WORD   cbPathOutMax = 300;
      WORD   cbPathOut;
      DWORD dwUsageCount;

      printf ("Calling SQLInstallDriverEx ...\n");
      if (!SQLInstallDriverEx(
            szDriver,
            szPathIn,
            szPathOut,
            cbPathOutMax,
            & cbPathOut,
            ODBC_INSTALL_COMPLETE,
            & dwUsageCount))
         ShowErrors ();

      printf ("Calling SQLConfigDriver ...\n");
      if (!SQLConfigDriver(
            NULL,
            ODBC_INSTALL_DRIVER,
            "Microsoft Access - test 4",
            "",
            szPathOut,
            cbPathOutMax,
            & cbPathOut))
         ShowErrors ();
   }
				

Properties

Article ID: 174655 - Last Review: August 25, 1999 - Revision: 1.0
APPLIES TO
  • Microsoft Open Database Connectivity 3.0
Keywords: 
kbcode kbprb KB174655
Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com