We had to upgrade our Microsoft Data Access Components (MDAC) to version 2.6 on every PC/server and ran into a problem. Each attempt to connect to a SQL Server 7.0 or SQL Server 2000 database using an IP address (rather than the server name) took an extreme amount of time and eventually timed out. After troubleshooting for a day, which included attempting to roll back to the prior version of the MDAC, we came across Microsoft article...
Q300420, which stated:
In certain reported cases, a "Timeout expired" error is reported to the client application and the connection attempt fails or is extremely slow in its access times. Be aware that if you are using a server alias which maps to a TCP/IP address, this problem can still occur. This problem does not occur with MDAC 2.5 or 2.1 installed.
CAUSE: The MDAC 2.6 version of the SQL Server Network Library, Dbnetlib.dll, attempts to determine the host name of the IP address using a REVERSE lookup in DNS. If the client computer has a slow Domain Naming Service (DNS) server, or no DNS server, and the local HOSTS or LMHOSTS file on the computer does not contain the host name for the IP address of the SQL Server, the reverse lookup will time out after five seconds and/or your access to your databases will be extremely slow.
Note that this is an internal timeout inside of the SQL Server driver code only, and it may or may not generate a timeout error in the client application. The connection attempt can succeed, but every new connection made by the application will encounter the same five-second delay causing an overload of the database.
RESOLUTION: To resolve this problem, obtain the latest service pack for Microsoft SQL Server 2000. At time of this article, it would be service pack 2.
WORKAROUND: To work around this problem, either provide some reliable means for performing a reverse lookup of the SQL Server server's IP address(setup a reverse lookup zone on your DNS server), use the SQL Server machine name instead of the IP address(which sometimes does not always work on some networks), or apply this hotfix.
Use the HOSTS file or LMHOSTS, put the TCP/IP address of the SQL Server server at the start of the line followed by a few spaces followed by the machine name of the SQL Server server. For example:18.104.22.168 myservername
The HOSTS or LMHOSTS file belongs in the System32DriversEtc directory for client computers running Microsoft Windows NT and Microsoft Windows 2000, or in the Windows directory for clients running Microsoft Windows ME, Microsoft Windows 98, or Microsoft Windows 95.
We first tried using the hosts file on a single PC and added each SQL server into it. It corrected everything! Microsoft says in the article that service pack 2 fixes the issue, but it did not for us.
- What do you think about this tip? E-mail the Editor at email@example.com with your feedback.
- The Best SQL Server Web Links: tips, tutorials, scripts, and more.
- Have an SQL Server tip to offer your fellow DBA's and developers? The best tips submitted will receive a cool prize--submit your tip today!
- Ask your technical SQL Server questions--or help out your peers by answering them--in our live discussion forums.
- Check out our Ask the Experts feature: Our SQL, Database Design, Oracle, SQL Server, DB2, metadata, and data warehousing gurus are waiting to answer your toughest questions.