当我尝试通过jdbc连接eclipse和sql server时,我反复得到这两个错误。任何人都可以帮我解决这个问题或解释为什么会这样做?
1.与主机localhost,端口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);
答案 0 :(得分:0)
从连接字符串中取出encrypt=true;trustServerCertificate=true
。您的SQL Server可能未设置为使用SSL进行连接。