private String url = "jdbc:mysql://localhost:3306/day17"; // jdbc协议:数据库子协议:主机:端口/连接的数据库 // private String user = "root";//用户名 private String password = "root";//密码 public static void test1(){ Class.forName("com.mysql.jdbc.Driver"); //Class.forName("com.mysql.jdbc.Driver"); Connection conn = DriverManager.getConnection(url, user, password); }