Saturday, January 16, 2010

How to remote connect to SQL Server 2005 by Specific TCP Port

SQL Server 2005 is not configured to accept remote connections. By default.

To allow remote connections, you have to complete all the following steps:

  • Enable remote connections on the instance of SQL Server that you want to connect to from a remote computer.
  • Configure SQL Server to Listen on a Specific TCP Port.
  • To open a port in Windows Firewall.
  • Connect to SQL Server 2005 by using MS SQL Server Management Studio with port number.

Enable remote connections on the instance of SQL Server that you want to connect to from a remote computer.
  1. Click Start, point to Programs, point to Microsoft SQL Server 2005, point to Configuration Tools, and then click SQL Server Surface Area Configuration.
  2. On the SQL Server 2005 Surface Area Configuration page, click Surface Area Configuration for Services and Connections.
  3. On the Surface Area Configuration for Services and Connections page, expand Database Engine, click Remote Connections, click Local and remote connections, click the appropriate protocol to enable for your environment, and then click Apply.

    Note Click OK when you receive the following message:
    Changes to Connection Settings will not take effect until you restart the Database Engine service.
  4. On the Surface Area Configuration for Services and Connections page, expand Database Engine, click Service, click Stop, wait until the MSSQLSERVER service stops, and then click Start to restart the MSSQLSERVER service.
Configure SQL Server to Listen on a Specific TCP Port
  1. In SQL Server Configuration Manager, in the console pane, expand SQL Server 2005 Network Configuration, expand Protocols for <instance name>, and then double-click TCP/IP.
  2. In the TCP/IP Properties dialog box, on the IP Addresses tab, all the IP addresses available in your computer is listed in here ... IP1, IP2, up to IPAll. Right-click one of address, and then click Properties to identify the IP address that you wish to configure.
  3. The TCP Dynamic Ports dialog box contains 0, indicating the Database Engine is listening on dynamic ports. Which means they select an available port when the SQL Server service is started. To disable listening dynamic port you can delete the 0 and left the blank.
  4. In the IPn Properties area box, in the TCP Port box, type the port number you wish this IP address to listen on, and then click OK.
  5. In the console pane, click SQL Server 2005 Services.
  6. In the details pane, right-click SQL Server (<instance name>) and then click restart, to stop and restart SQL Server.

To open a port in Windows Firewall
  1. On the Start menu, click Control Panel.
  2. In Control Panel, click Network and Internet Connections, and then open Windows Firewall.
  3. In Windows Firewall, click the Exceptions tab, and then click Add Port.
  4. In the Add a Port dialog box, in the Name box, type SQL Server <instanceName>.
  5. In the Port number box, type the port number of the Database Engine instance. Use 1433 for the default instance. Type 1500 if you are configuring a named instance and configured a fixed port to 1500 . Verify that TCP is selected, and then click OK
Connect to SQL Server 2005 by using MS SQL Server Management Studio with port number
  1. Open SQL Server Management Studio, In the Connect to Server dialog box, in the Server Name box type xxx.xxx.xxx.xxx\SQLEXPRESS,1500.
  2. type user name and password to connect to server.