PRB: ODBC Error 01000 (-1): ConnectionOpen (sopen())

Last reviewed: June 27, 1995
Article ID: Q115995
The information in this article applies to:
  • Microsoft FoxPro for Windows, versions 2.5, 2.5a, 2.5b
  • Microsoft FoxPro Connectivity Kit, version 2.5

SYMPTOMS

When you are trying to connect to an SQL Server machine with a DBConnect() function, you receive the following error message from DBError():

   ODBC error 01000 (-1): [Microsoft][ODBC SQL Server Driver][dbnmp3]
   ConnectionOpen (sopen()).

RESOLUTION

The error is caused by an incorrect server name in the ODBC Driver Manager's Setup application in the Control Panel.

MORE INFORMATION

The following steps and code reproduce the problem using an SQL Server:

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

          Data Source Name: test
          Description: test
          Server: WRONG_SRV
    

    NOTE: WRONG_SRV is a nonexistent server name; if the correct server name appears in the ODBC Driver Manager's Setup for the driver, the example below will return a valid connection.

    The server name will vary depending upon the network and the actual name that the server's administrator has given the server. For more information about setting up the correct server name for the network in use, choose the Help button and look under the section for "Server."

  2. Type in the following program and run it:

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

          errval=0
          errmsg=' '
    
          sourcename= 'test      '  && This is the source name specified
                                    && in the ODBC Driver Manager.
    
          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: FoxWin 2.50 2.60 ODBC CK 01000 errmsg err msg
KBCategory: 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: June 27, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.