Funky SQL Ports…


Great tip from Bill Brockbank... Useful in very tightly locked-down environments....


.NET Data Access Architecture Guide


http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/daag.asp


******************************************************


Specifying a Port


If your instance of SQL Server is configured to listen on a port other than the default 1433, you can specify the port number to connect to by:



  • Using the Client Network Utility.
  • Specifying the port number with the "Server" or "Data Source" name-value pair supplied to the connection string. Use a string with the following format:
·                "Data Source=ServerName, PortNumber"
  

Note   ServerName might be an IP address or Domain Name System (DNS) name. For optimum performance, use an IP address to avoid a DNS lookup.


 


So, if we were configured to listen on port 1450, we would specify  A connection string like:


             “Data Source=SQLRocks, 1450”


 


Note also that in some cases, you will need to modify the SQL Client to connect on the appropriate port. Run the SQL Client Network Utility to do this....


Comments (2)
  1. Jon Galloway says:

    This is also useful in case UDP port 1434 is blocked (which many IT shops did after the SQL Slammer worm).

    The UDP connection on 1434 is used to tell clients which port to talk to SQL Server on, and if 1434 is blocked then clients won’t be able to find the server even if it’s on 1433. The syntax you pointed out gets around that by explicitly specifying the port.

  2. Darrell says:

    Yep, like Jon said. Also, you should always change the standard ports for security reasons anyway. What’s to keep someone from just looking in the registry you ask? Encryption, that’s what!

    The SQL Client Network utility just creates either registry keys or a UDL file that tells you how to connect to the SQL Server. You could alternatively put that in the registry or encoded in a config file or whatever.

Comments are closed.

Skip to main content