当我尝试通过 jdbc 将 eclipse 与 sql server 连接时,我反复收到这 2 个错误。谁能帮我解决这个问题或解释为什么我会得到这个?
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);
原文由 Navin Kumar 发布,翻译遵循 CC BY-SA 4.0 许可协议
打开时转到
在哪里可以找到协议 TCP/IP,如果禁用,则启用它 单击 TCP/IP,您将找到它的属性。
在此属性 中删除所有 TCP 动态端口并将值 1433 添加到所有 TCP 端口并重新启动 SQL Server 服务 > SQL Server
它完成了…