Windows 7 AppCompat changes and SQL Server client and setup hangs

Windows 7 and Windows Server 2008 R2 include many changes to the core operating system. This blog post is targeted at resolving the impact on SQL Server client drivers and SQL Server setup of one breaking change in Windows 7 and Windows Server 2008 R2.

The changes to behavior of the GetOverlappedResult API, which SQL Server client drivers use for performing network reads and writes, is described here: When SQL Server client drivers get the new Windows behavior of GetOverlappedResult, they will reliably hang as soon as the network connection is opened. So, when using ADO.Net, you would notice that the thread hangs as soon as your application calls SQLConnection.Open(). This also applies to other client drivers, like the SQL Server Native Client 10.0. Since SQL Server’s setup includes making connections to the database instance to perform various T-SQL queries, this may also cause a hang during SQL Server setup. It sounds like a serious problem!

Fortunately, Windows 7 and Windows Server 2008 R2 also built in the “Switchback” feature to keep existing applications working. Switchback examines some properties of the process and DLLs and determines whether they should receive the new Windows 7 behavior or the pre-existing Windows behavior. For all existing SQL Server clients, SwitchBack should choose the original Windows behavior by default, so you should never see this hang.

However, Switchback can be manually overridden, causing the OS to always give all applications the new Windows behavior. If that override is set, SQL Server clients will reliably show the hang described above. To check if this is the source of your SQL Server connection’s hang, check this registry key:


If this key exists, and it has the value SbEnable set to 0, the Switchback functionality is overridden. To allow SQL Server client drivers to connect, set the SbEnable value to 1 and restart the machine.

UPDATE: I wanted to add that this setting is usually configured through Group Policy for multiple machines, rather than individually through the registry as described above. The Group Policy setting is named "Turn off Switchback Compatibility Engine" and can be configured as described in this technet article: As described above, the Switchback Compatibility Engine needs to be running (so this setting needs to be Disabled) for SQL Server's client drivers/providers to function correctly.

Dan Benediktson
SQL Server Protocols

Disclaimer: This posting is provided "AS IS" with no warranties, and confers no rights

Comments (2)

  1. Dhaval says:

    Many thanks..It works like a master key.

Skip to main content