DBNetLib sets hard-coded KeepAliveTime and KeepAliveInterval

This article has been archived. It is offered "as is" and will no longer be updated.
Important This article contains information about how to modify the registry. Make sure to back up the registry before you modify it. Make sure that you know how to restore the registry if a problem occurs. For more information about how to back up, restore, and modify the registry, click the following article number to view the article in the Microsoft Knowledge Base:
256986 Description of the Microsoft Windows registry
If you connect from a client to your SQL Server using either the Microsoft ODBC Driver for SQL Server, the Microsoft OLE DB Provider for SQL Server, or the System.Data.SqlClient managed provider, and you keep your connection idle for about 30 seconds, under certain circumstances you notice that the client is sending keep-alive TCP/IP packets to the server.
DBNetLib.dll is the client-side network library for SQL Server, and it is included with Microsoft Data Access Components (MDAC). SQL Server ODBC driver, SQL Server OLE DB Provider, or System.Data.SqlClient managed provider all use DBNetLib to communicate to a back-end SQL Server. When you use the TCP/IP protocol to connect to your SQL Server, in certain circumstances DBNetlib sets the KeepAliveTime and KeepAliveInterval registry settings in the underlying TCP/IP socket layer.

DBNetlib (that is included with MDAC versions 2.5, 2.6, or 2.7) has hard-coded values for KeepAliveTime and KeepAliveInterval. The hard-coded value For KeepAliveTime is 30,000 milliseconds, and the hard-coded value for KeepAliveInterval is 1,000 milliseconds.

Because DBNetlib sets the values for KeepAliveTime and KeepAliveInterval in the underlying TCP/IP socket that it opens, you may see keep-alive packets going from client to server if you keep your connection idle for more than 30 seconds.

Note The fix in this article applies to MDAC 2.7 SP1 only.
A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Only apply it to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next P1 that contains this hotfix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question. The English version of this fix has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.
   Date         Time   Version          Size    File name   ---------------------------------------------------------   19-Mar-2003  23:14  2000.81.9031.40  61,440  Dbnetlib.dll
To work around this problem, use your connection frequently, and do not keep it idle for more than 30 seconds.
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
Warning Serious problems might occur if you modify the registry incorrectly by using Registry Editor or by using another method. These problems might require that you reinstall your operating system. Microsoft cannot guarantee that these problems can be solved. Modify the registry at your own risk.With this fix you can make changes to the default KeepAliveTime and KeepAliveInterval registry settings that DBNetLib uses. To change the default values, you must edit the following two registry keys:
  • HKLM\SOFTWARE\Microsoft\MSSQLServer\Client\SuperSocketNetLib\Tcp ==> KeepAliveTime : DWORD : <dwValue>
  • HKLM\SOFTWARE\Microsoft\MSSQLServer\Client\SuperSocketNetLib\Tcp ==> KeepAliveInterval : DWORD : <dwValue>

If you do not have these registry keys (KeepAliveTime and KeepAliveInterval) in the following location:
DBNetlib uses the default value (30,000 milliseconds and 1,000 milliseconds, respectively). If you want to change these default values, add these registry keys, and then set their value. Note that these values are in milliseconds.
dbnetlib keepalive 30 tcp/ip socket

Article ID: 816649 - Last Review: 02/27/2014 18:43:18 - Revision: 4.2

  • Microsoft Data Access Components 2.7
  • Microsoft Data Access Components 2.7 Service Pack 1
  • Microsoft Data Access Components 2.6
  • Microsoft Data Access Components 2.5
  • kbnosurvey kbarchive kbfix kbqfe kbhotfixserver KB816649