import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class DBConnect {
public static void main(String[] args) {
String host = ("jdbc:derby://localhost:1527/Employees");
String uName = ("sa");
String uPass = ("saa");
try {
Connection con = DriverManager.getConnection(host, uName, uPass);
}
catch ( SQLException err) {
System.out.println( err.getMessage());
}
}
}
线程“main”中的异常java.lang.RuntimeException:无法编译的源代码 - 异常java.sql.SQLException永远不会[此处缺少片段]
答案 0 :(得分:1)
代码看起来不错,只是您将DriverManager
拼错为DriveManager
。 (注意缺少'r')