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

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

问题描述

当我尝试通过 jdbc 连接eclipse与 sql server 时,我重复得到这2个错误。有没有人可以帮我这个或解释为什么我得到这个?

  1。到主机本地主机,端口1433的TCP / IP连接失败。 
2.驱动程序无法使用安全套接字层(SSL)加密建立与SQL Server的安全连接。

谢谢。

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


解决方案

 开始> Microsoft SQL Server>配置工具> SQL Server配置管理器

打开时转到

  SQL Server配置管理器> SQL Server网络配置> SQLExpress的协议

在哪里可以找到协议TCP / IP,如果禁用,启用它点击TCP / IP,您将找到其属性。



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



其完成...


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

解决方案

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...

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

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