我正在尝试从java连接到mssql服务器,但我无法弄明白。它会引发异常
ERROR: No suitable driver found for jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=MLS_J
这是下面的代码。我究竟做错了什么?我该如何解决这个问题?
public static String connection_test(){
String address = "jdbc:sqlserver://192.168.1.101:1433;DatabaseName=MLS_J";
String user = "sa";
String password = "xxxx";
try {
Connection conn = DriverManager.getConnection(address, user, password);
java.sql.Statement stmt = conn.createStatement();
return "Bağlantı kapalımı? - " + conn.isClosed();
} catch (Exception e) {
return "ERROR: " + e.getMessage();
}
}