Sql-server – SQL Server Management Studio – connection with SQL Server database engine

connectivitysql serverssms

This question regards SQL Server 2005 and 2012.

I have a database server with two instances of SQL Server. Through SQL Server Management Studio I was able to connect to both instances by providing "IP-Address"\"InstanceName" and user ID/password. But, I was not able to telnet the server on port 1433 from command prompt of the client PC.

Finally, when I specified TCP port 1433 through "SQL Server Configuration Manager" on the server and restart SQL Server services I was able to telnet to server on port 1433.

I want to know how "SQL Server Management Studio" was able to make a connection with SQL Server even if port 1433 was not active on SQL Server? And, the sequence of activities that takes place in background when Management Studio initiates connection with SQL Server?

Best Answer

Please do not change Sql Server's TCP port unless you know what you are doing. This needs to be done only in specific scenarios like manual SPN registrations with failover cluster setups or restricted environments.

Sql Server installations contain a special service called Sql Browser Service. When a client tries to connect to a named instance, it will ask connection details from the browser service. As per the documentation:

Upon startup, SQL Server Browser starts and claims UDP port 1434. SQL Server Browser reads the registry, identifies all instances of SQL Server on the computer, and notes the ports and named pipes that they use --

When SQL Server clients request SQL Server resources, the client network library sends a UDP message to the server using port 1434. SQL Server Browser responds with the TCP/IP port or named pipe of the requested instance. The network library on the client application then completes the connection by sending a request to the server using the port or named pipe of the desired instance.