The information in this article applies to:
SUMMARY
There are four possible problem areas that can contribute to a failure to
connect to a database server when using ODBC and Visual Basic:
MORE INFORMATION
The following describes each of the four areas, giving possible errors and
problems that can arise if things are not set up correctly.
INI file settingsThere are two .INI files (ODBCINST.INI and ODBC.INI) that must reside in the Windows directory and must contain correct information about the installed ODBC drivers and servers.ODBCINST.INI contains the ODBC driver information needed to register new servers using the RegisterDataBase() statement in Visual Basic. Here is an example .INI file for the SQL Server driver that ships with Visual Basic:
The [ODBC Drivers] section tells the driver manager the names of the installed drivers. The [SQL Server] section tells the ODBC driver manager the names of the dynamic link libraries (DLLs) to use to access data from a server set up as a SQL Server. The order of the two sections and their entries is arbitrary. ODBC.INI contains the data for each installed driver. The driver manager uses this information to determine which DLL to use to access data from a particular database backend. Here is an example of a file containing three data sources all using the SQL Server driver:
The first section tells the driver manager which sections appearing below it define the data source. As you can see, each entry has a value (in this case, SQL Server) that matches a value from the ODBCINST.INI file. If the information on a data source is incorrect or missing, you may get the following error:
If the DLL listed on the Driver=... line cannot be found or is corrupt, the following error may occur:
ODBC and Driver DLLsThe following DLLs must be on the path or in the Windows system directory in order for ODBC to be accessible from Visual Basic:
If VBDB300.DLL is missing or corrupt, you see the following error in Visual Basic when you try to run the application:
If either the ODBC.DLL or ODBCINST.DLL file is missing or corrupt, you see the following error in Visual Basic when you try to run the application:
The SQL Server driver requires the following files:
If the SQLSRVR.DLL is missing or corrupt, you see the following error when calling the OpenDataBase() function with a SQL Server data source:
If the SQLSETUP.DLL is missing or corrupt, you see the following error when calling the RegisterDataBase statement with SQL Server as the driver name:
Server Information Needed to Connect to a Data SourceCertain information is needed to connect to a data source using the OpenDataBase() function. This information is obtainable from the server administrator in the case of SQL Server. The following is an example of a call to the OpenDataBase() function to connect to a SQL Server called CorpSQL as a user named Guest with password set to taco:
If any of this information is missing, an ODBC dialog box appears to give a user a chance to supply the needed data. If the information is incorrect, the following error occurs:
Information Specific to Microsoft SQL ServersThe Microsoft SQL Server ODBC Driver calls system catalog stored procedures on the SQL Server to obtain catalog information. If the driver attempts to connect to a SQL Server with an older version of these catalog stored procedures than those expected by the driver, the following error occurs:
Microsoft Knowledge Base Article Q137636 has information that the SQL Server system administrator can use to determine if these stored procedures need to be upgraded, and the procedure they should follow to do so. Additional query words: 3.00
Keywords : |
Last Reviewed: May 24, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |