Microsoft KB Archive/174655

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 12:31, 21 July 2020 by X010 (talk | contribs) (Text replacement - "&" to "&")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Base


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

Article ID: 174655

Article Last Modified on 8/25/1999



APPLIES TO

  • Microsoft Open Database Connectivity 3.0



This article was previously published under Q174655

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 ();
   }
                


Additional query words: jet desktop database

Keywords: kbprb kbcode KB174655