PRB: ODBC Error IM002 (0): Data Source Not Found...

Last reviewed: April 30, 1996
Article ID: Q112479
The information in this article applies to:
  • Microsoft FoxPro Connectivity Kit, version 2.5
  • Microsoft FoxPro for Windows, versions 2.5, 2.5a, and 2.5b
  • Microsoft FoxPro for MS-DOS, versions 2.5, 2.5a, and 2.5b

SYMPTOMS

When you are trying to connect to a server with a DBConnect() command, the following error message is displayed:

   ODBC error IM002 (0): [Microsoft][ODBC DLL] Data source not found
   and no default driver specified

RESOLUTION

This error could be caused by one of the following situations:

  • The Data Source Name in the Control Panel's ODBC Driver Manager does not match the Data Source Name in the DBConnect() command.

    For example, in the Control Panel's ODBC Driver Manager for the ODBC driver, if the Data Source Name in the Setup dialog box is "test" (without the quotation marks), and you issue the following DBConnect() command

          handle=DBConnect('wrong_name','sa','')
    

    you will receive a negative number for the handle, and after calling DBError(), you will receive the error message.

    To correct the problem in the above example, change the DBConnect() line to:

          handle=DBConnect('test','sa','')
    

    Syntax of DBConnect() ---------------------

          DBConnect(<Data source name>,<User identifier>,<Password>,
    
                    <Connection string>)
    
       -or-
    
    
  • You are using Oracle and are not specifying the connect string as the forth parameter. Page 32 of the Microsoft FoxPro Connectivity Kit "User's Guide" states:

          Although many ODBC drivers don't require a connection string,
          some do. If you include a connection string, FoxPro passes the
          connection string to the ODBC driver. For more information, see
          your ODBC driver documentation.
    

    For more information about the Oracle connect string:

    1. Open the Control Panel and double-click the ODBC Driver Manager.

    2. Select the Oracle driver from the Data Sources (Driver) list.

    3. Click the Help button.

    4. On the Help screen that comes up, scroll to the section that reads

          "SQL*Net Connect String."
    

MORE INFORMATION

To reproduce the problem using SQL Server:

  1. In the Control Panel's ODBC Driver Manager, set up a SQL Data Source with the following information:

          Data Source Name: test
          Description: test
          Server: REDDFOXX
    

    The server name will vary depending upon the network and the actual name that the server's administrator has given the server.

  2. Create and run the following program:

          SET LIBRARY TO SYS(2004)+"fpsql.fll"
          PUBLIC errval
          PUBLIC errmsg
          PUBLIC handle
    

          errval=0
          errmsg=' '
          sourcename= 'wrong_name'  && This should have been
    
                                    && sourcename='test'
    
          user= 'sa'                && This is your user ID for SQL
                                    && Server.
    
          passwd=''                 && Password for the user ID on the
                                    && line above.
    
          ********CONNECT
    
          handle=DBConnect(sourcename,user,passwd)
          IF handle > 0
             WAIT WINDOW 'Successfully Connected' nowait
          ELSE
             error=DBError(0,@errmsg,@errval)
             WAIT WINDOW STR(error)+' '+STR(errval)+' '+errmsg
          ENDIF
    


Additional reference words: FoxDos FoxWin 2.50 IM002 ODBC CK
errmsg err msg
KBCategory: kbinterop kb3rdparty kbnetwork kbprg kberrmsg kbprb kbcode
KBSubcategory: FxtoolCk


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 30, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.