Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The TCP/IP connection to the host localhost, port 1433 has failed

I'm getting this 2 errors repeatedly when I'm trying to connect eclipse with sql server through jdbc. Could anyone help me with this or explain why am I getting this?

1. The TCP/IP connection to the host localhost, port 1433 has failed.   2. The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. 

Thank you.

String driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; Class.forName(driver).newInstance(); String connString      ="jdbc:sqlserver://localhost:1433/databaseName=Engg_Street;instance=SQLSERVER;encrypt=true;     trustServerCertificate=true"; String username = "Vijayalakshmi"; String password = ""; conn = DriverManager.getConnection(connString,username,password); 
like image 802
Navin Kumar Avatar asked Sep 24 '13 12:09

Navin Kumar


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.

Why is port 1433 blocked?

Port 1433 disabled on the MS-SQL Server In previous versions of MS-SQL server, port 1433 was enabled (open) by default, but as a hardening procedure implemented to improve security of the MS-SQL server, port 1433 is disabled in current versions of MS-SQL Server.

How do you check port 1433 is open or not?

Check SQL Server configuration manager to see if it's a specific port, or dynamic ports. If it's using dynamic ports, then as long as you don't have multiple instances on the server, netstat -abn is probably the simplest way to find what it's using.


1 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  

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

In this properties Remove All the TCP Dynamic Ports and Add value of 1433 to all TCP Port and restart your SQL Server Services > SQL Server

And Its Done...

like image 142
sunysen Avatar answered Oct 18 '22 11:10

sunysen