所以我设置了我的代码
public static Connection getConnection() {
try {
String dbURL = "jdbc:sqlserver://localhost:1433;databaseName=HRDB;
String user = "sa";
String pass = "r";
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
Connection conn = DriverManager.getConnection(dbURL, user, pass);
return conn;
} catch (ClassNotFoundException c) {
return null;
} catch (SQLException s) {
System.out.println(s.toString());
return null;
}
}
但是,当我尝试连接到数据库时,我得到以下例外情况。
com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "java.lang.RuntimeException: Could not generate DH keypair".