ACC: Using Win.ini & Odbc.ini When Linking SQL Server Table

ID: Q96110


The information in this article applies to:


SUMMARY

Advanced: Requires expert coding, interoperability, and multiuser skills.

This article discusses how the ODBC Driver manager and the SQL Server driver use the Win.ini and Odbc.ini files during connection time.


MORE INFORMATION

For the purposes of this article, the following is assumed:

Given these assumption, if the setup was done correctly, the Odbc.ini file will have the following entry in the [ODBC Data Sources] section:


   mysqlsvr=SQL Server 


There will be a section called [mysqlsvr] in the Odbc.ini and it will have entries of the following form:


   DRIVER=c:\windows\system\sqlsrvr.dll
   Description=SQL\Server on server Unixmc
   OemToAnsi=No
   Network=wdbftptc
   Address=11.1.4.40,3180 


The DRIVER entry points to the location of the SQL Server driver. It is located on the System subdirectory of the Windows directory.

The Description entry describes what kind of a data source this is. This is something that you can change when setting up the data source by using ODBC Administrator.

The OemToAnsi entry indicates whether conversion needs to be done from the OEM code page to the ANSI code page. Note that this is not the same as the translation DLL.

The Network entry indicates the name of the net-library.

The Address entry indicates the network address.

The WIN.INI file will have the following entry in its [SQLSERVER] section:


   mysqlsrvr=wdbftptc,11.1.4.40,3180 


When you run a SQLConnect or SQLDriverConnect command and choose to connect to the mysqlsvr data source, the Driver manager looks in the ODBC.INI file to find the name and location of the SQL Server driver. It looks for the DRIVER entry described above and loads it into memory.

Next, the SQL Server driver looks in the Win.ini file's [SQLSERVER] section for mysqlsvr entry where it picks up the name of the net-library. Then it loads the net-library name (wdbftptc in this case) into the memory. Next, it looks at the entry again to get the address of the server which it passes on to the net-library. If there is no address following the name of the net-library, it passes the name of the data source to the net-library, as the network address.

Db-library users should note that unlike W3dblib.dll, the SQL Server driver does not look at the dsquery entry unless dsquery is a data source in the Odbc.dll file.

If you are using Microsoft Access, this sequence of operations takes place when you link (attach) a SQL Server table. If you are using Microsoft Visual Basic, it takes place in response to the OpenDataBase call.


Keywords          : kbusage OdbcOthr 
Version           : 1.0 1.1 2.0
Platform          : WINDOWS 
Issue type        : kbinfo 

Last Reviewed: March 20, 1999