Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQLServerException: TCP/IP connection to the host has failed

Tags:

sql-server

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?

like image 247
SS89 Avatar asked Dec 03 '12 10:12

SS89


People also ask

How do I fix the TCP IP connection to the host localhost port 1433 has failed?

Thanks. Go to sql configuration manager > expand sql server network configuration > click on your instance > click on tcp/ip with the right button > go to properties > on the top tab click on IP Addresses > remove all "0" (zero) values ​​from TCP dynamic ports > include the value 1433 in all tcp ports > click ok.

How do you fix a TCP error?

Check the TCP/IP services configuration file. Verify that a SequeLink service is listening on the server host at the specified port. Use the netstat -a command on the host to obtain a list of TCP ports that are in the listening state. Check for congestion problems on the server.

How can I tell if SQL Server is accepting TCP IP connections?

Please go to SQL Server Configuration Manager -> expand SQL Server Network Configuration->Protocols for InstanceName, make sure TCP/IP is enabled.

How do I enable TCP IP connection in SQL Configuration Manager?

Enable TCP/IP in the SQL ServerExpand the Configuration Tools subfolder and right-click on SQL Server Configuration Manager. Click on Run as Administrator. Select SQL Server Network Configuration and click Protocols for SMTKINGDOM. In the right pane, right-click TCP/IP and click Enable.


2 Answers

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
like image 74
Ravindra Bagale Avatar answered Oct 17 '22 05:10

Ravindra Bagale


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/

like image 20
lmoglia Avatar answered Oct 17 '22 06:10

lmoglia