lundi 4 novembre 2013

SQL Server Management Studio unable to connect using server alias !

When you try to connect to SQL Server using an alias from SQL Server Management Studio you receive the error 53 :

A network-related  or instance-specific error occurred while establishing a connection to SQL Server.
The SQL Server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections.(provider: Named Pipes Provider, error : 40- Could not open a connection to SQL Server) (Microsoft SQL Server, Error : 53)

 


But when you use SQLCMD to connect to the same server using the same ALIAS no problem !!!

  


The issue is related to the fact that SSMS is a 32 Bit application but SQLCMD is 64 bit application; when we use cliconfg.exe to create server SQL Server aliases thay are created only for the 64 bit registry entry :



But not created for the 32 bit registry tree as you can see on the screen capture:



To resolve this issue you have just to create a new string (REG_SZ) registry value on the the registry key Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MSSQLServer\Client\ConnectTo with name of "Your SQL Server Alias" and value of "DBMSSOCN,<Your SQL Server Alias>,<port number>" .

Now you can connect to your SQL Server using the Alias and SSMS :