PRB: ODBC Error 01000 (-1): ConnectionOpen (sopen())
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:
- 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."
- 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 query words:
FoxWin 2.50 2.60 ODBC CK 01000 errmsg err msg
Keywords :
Version :
Platform :
Issue type :
|