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);
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.
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.
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.
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...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With