Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/354.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 到主机localhost端口1433的TCP/IP连接失败_Java_Sql Server_Eclipse_Jdbc - Fatal编程技术网

Java 到主机localhost端口1433的TCP/IP连接失败

Java 到主机localhost端口1433的TCP/IP连接失败,java,sql-server,eclipse,jdbc,Java,Sql Server,Eclipse,Jdbc,当我试图通过jdbc将eclipse与sqlserver连接时,我反复遇到这两个错误。有人能帮我吗?或者解释一下为什么我会得到这个 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) encrypti

当我试图通过jdbc将eclipse与sqlserver连接时,我反复遇到这两个错误。有人能帮我吗?或者解释一下为什么我会得到这个

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);
当它打开时,转到

SQL Server Configuration Manager > SQL Server Network Configuration > Protocols for SQLExpress 
您将在其中找到TCP/IP协议,如果禁用,则启用它单击TCP/IP,您将找到其属性

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


对于此类问题,您可以通过检查是否所有sql server相关服务都在运行来解决

TO check Start -> Run -> services.msc 
check services related to sql as
SQL Server (MSSQLSERVER)
SQL Server Agent (MSSQLSERVER)
SQL Server Analysis Services (MSSQLSERVER)
SQL Server Browser
SQL Server Integration Services 10.0
SQL Server Reporting Services (MSSQLSERVER)
SQL Server VSS Writer
启动上述所有服务。并将启动类型设置为自动

SQL Active Directory帮助程序服务不需要保持运行

它可以用来处理错误SQL server连接错误2 及 具有
与主机本地主机端口1433的TCP/IP连接失败。错误:“连接被拒绝:

如果您正在运行SQLSERVER EXPRESS:

使用“SQL Server配置管理器”或在Win+R上写入“mmc.exe”,并在“SQLEXPRESS协议”中搜索“SQL Server网络配置”,启用TCP/IP选项


我希望这对某些人有用!!

好吧,错误很明显:JDBC无法使用SSL连接到您的数据库。您的数据库是否配置为在端口1433上使用SSL?您正在使用的任何代码?帮助我们帮助您。嘿,我已经在我的新问题中发布了代码,您能帮助吗???@user2810964-不要这样做!编辑此问题以在此处添加您的代码!@Stephen C是的,我已经做了。这是一个错误“请求失败或服务没有及时响应“。数据库安装错误,请删除注册表,重新安装它对我有效!非常感谢。这对我也很管用。有人应该把这个答案标记为正确的。这对我来说也很有用!要澄清@sunysen的答案,请编辑列表底部标题为“IPAll”的条目。清除“TCP动态端口”字段并将“TCP端口”设置为1433。
TO check Start -> Run -> services.msc 
check services related to sql as
SQL Server (MSSQLSERVER)
SQL Server Agent (MSSQLSERVER)
SQL Server Analysis Services (MSSQLSERVER)
SQL Server Browser
SQL Server Integration Services 10.0
SQL Server Reporting Services (MSSQLSERVER)
SQL Server VSS Writer