当前位置:Gxlcms > mysql > mysql-编写JSP页面查询数据库不显示查询的结果

mysql-编写JSP页面查询数据库不显示查询的结果

时间:2021-07-01 10:21:17 帮助过:66人阅读

mysqljsp

<%try{    Class.forName("com.mysql.jdbc.Driver");    Connection conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/test2",            "root","xiaojuan00");    Statement stat=conn.createStatement();    ResultSet rs=stat.executeQuery("select * from user");    while(rs.next()){        System.out.print(rs.getString("name")+" ");        System.out.println(rs.getString("password"));    }    rs.close();    stat.close();    conn.close();}catch(Exception e){    e.printStackTrace();}%>

人气教程排行