到主机 localhost 的 TCP/IP 连接,端口 1433 失败 [英] The TCP/IP connection to the host localhost, port 1433 has failed

查看:63
本文介绍了到主机 localhost 的 TCP/IP 连接,端口 1433 失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试通过 jdbc 将 eclipse 与 sql server 连接时,我反复收到这 2 个错误.谁能帮我解决这个问题或解释为什么我会得到这个?

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.

谢谢.

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);

推荐答案

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

当它打开时转到

SQL Server Configuration Manager > SQL Server Network Configuration > Protocols for SQLExpress 

您可以在其中找到 TCP/IP 协议,如果禁用,则启用它 单击 TCP/IP,您将找到它的属性.

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

在此属性中 删除所有 TCP 动态端口并将值 1433 添加到所有 TCP 端口并重新启动您的 SQL Server 服务 > SQL Server

大功告成...

这篇关于到主机 localhost 的 TCP/IP 连接,端口 1433 失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆