qq_无_奈_0
Connection con=null; Statement stat=null; ResultSet rs=null; try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) { e.printStackTrace(); } try { con=DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","root"); stat=con.createStatement();这是在servlet连接数据库的操作,需要四个属性,driver:com.mysql.jdbc.Driver,URL:jdbc:mysql://localhost:3306/test,username:你数据库设置的name,password:你数据库设置的密码