Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host localhost, port 1433 has failed [duplicate]

Tags:

I keep on getting this error. I tried one solution from Stack Overflow (below), which did not work for me: SQL Exception while connecting to SQL server

I tried allowing port 1433 in the Windows firewall by using a link, that did not work either. Refer to section "To open a port in the Windows firewall for TCP access" http://msdn.microsoft.com/en-us/library/ms175043.aspx

com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host localhost, port 1433 has failed. Error: "Connection refused: connect. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.

Please help me to fix this problem.

like image 852
sweet dreams Avatar asked Aug 05 '12 23:08

sweet dreams


People also ask

Could not open connection to the host on port 1433 Connect failed?

Double click on TPC/IP which is on left panel. On Protocol tab if Enabled is No Then Make Yes. Then click on IP Address tab. Scroll down and last IPALL, set TCP Port as 1433.

How do I get SQL Server to accept TCP IP connections?

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.

How can I tell if port 1433 is working for SQL Server?

On the local machine, click the Start button and enter “CMD” in the search programs and files field. If the port 1433 is closed, an error will be returned immediately. If the port 1433 is open, you will be able to connect to the MS-SQL server.


2 Answers

You need to go to Start > Microsoft SQL Server > Configuration Tools > SQL Server Configuration Manager

When it opens, go to SQL Server Configuration Manager > SQL Server Network Configuration > Protocols for SQLExpress.

There you'll find the Protocol TCP/IP, if disabled then Enable it. Click on TCP/IP, you'll find its properties.

In these properties, remove all the TCP Dynamic Ports and add value of 1433 to all TCP ports, and restart your SQL Server Services > SQL Server

And it's done.

like image 159
Parth Soni Avatar answered Sep 28 '22 02:09

Parth Soni


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 27
RKannan Avatar answered Sep 28 '22 03:09

RKannan