public?class?Test?{
????private?static?String?url?=?"jdbc:mysql://127.0.0.1:3306/students";
????private?static?String?user?=?"root";
????private?static?String?password?=?null;
????private?static?java.sql.Connection?con?=?null;
????static?{
????????try?{
????????????Class.forName("com.mysql.jdbc.Driver");//在這一行報錯,Not?Found?Class?Exception
????????}?catch?(ClassNotFoundException?e)?{
????????????e.printStackTrace();
????????}
????????try?{
????????????con?=?DriverManager.getConnection(url,?user,?password);
????????}?catch?(SQLException?e)?{
????????????e.printStackTrace();
????}
}
添加回答
舉報
0/150
提交
取消
