8
votes

When I am running an Web application, I get an error message

"The TCP/IP connection to the host,port 1433 has failed. Error: "connect timed out. Verify the connection properties, check that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port, and that no firewall is blocking TCP connections to the port."

The TCP/IP is active and enabled and the TCP port defaults to 1433.,But I still get this error message.

Could anyone help me on this?

2
What connection string are you using? Have you tried using sqlcmd from your web host (if possible) to see if you can reach SQL Server from the web host? Is your instance of SQL Server running under a non-default name - eg SERVER\instance rather than just SERVER.Ian Yates
Thanks lan. SQlServer was unexpectedly shutdown. Its working fine now.SS89

2 Answers

12
votes

Remove All the TCP Dynamic Ports and Add value of 1433 to all TCP Port and restart your SQL Server

Steps

  • Open the Sql Server Configuration Manager (Start -> Programs -> Microsoft SQL Server 2008 -> Configuration Tools)
  • Expand SQL Server Network Configuration -> [Your Server Instance]
  • Double click TCP/IP
  • Under Protocol:Ensure Enabled is Yes
  • Under IP Addresses:Scroll to the bottom and set the TCP Port under IPAll, (1433 by default)
  • Find the IP address you want to connect to and set Enabled and Active to Yes
3
votes

I had the same problem while i was trying connect to MSSQL Server remotely using JDBC (dbeaver on debian). After a while, I found out that my Windows Firewall configuration was not set up correctly. So maybe this could help you!

Here's how to configure Windows Firewall to allow network traffic that is related to SQL Server and to the SQL Server Browser service. Four exceptions must be configured in Windows Firewall to allow access to SQL Server:

  1. Create a port exception for TCP Port 1433:

    1. Open Windows Firewall with Advanced Security
    2. In the left pane, right click on Inbound Rules -> New Rule to get the wizard
    3. What type of rule would you like to create? Select Port
    4. Select TCP and specify port 1433
    5. What action should be taken when a connection matches the specified conditions? Allow the connection
    6. When does the rule apply? Choose all three profiles (Domain, Private & Public)
    7. Name the rule “SQL – TCP 1433″
  2. Add a port exception for UDP Port 1434:

    1. Right click on Inbound Rule, click New Rule again and use the following information to create another port
    2. Select Port
    3. Select UDP and specify port 1434
    4. Allow the connection
    5. Choose all three profiles (Domain, Private & Public)
    6. Name the rule “SQL – UDP 1434"
  3. Add a program exception for sqlservr.exe:

    1. Click New Rule again and use the following information to create a program exception:
    2. Select Program
    3. Click Browse to select ‘sqlservr.exe’ at this location: C:\Program Files\Microsoft SQL Server\MSSQL11.INSTANCE_NAME\MSSQL\Binn\sqlservr.exe where INSTANCE_NAME is the name of your SQL instance.
    4. Allow the connection
    5. Choose all three profiles (Domain, Private & Public)
    6. Name the rule "SQL – sqlservr.exe"
  4. Add a program exception for sqlbrowser.exe:

    1. Click New Rule again and use the following information to create another program exception:
    2. Select Program
    3. Click Browse to select sqlbrowser.exe at this location: C:\Program Files\Microsoft SQL Server\90\Shared\sqlbrowser.exe
    4. Allow the connection
    5. Choose all three profiles (Domain, Private & Public)
    6. Name the rule "SQL - sqlbrowser.exe"

Source: http://blog.citrix24.com/configure-sql-express-to-accept-remote-connections/