时间:2021-07-01 10:21:17 帮助过:66人阅读
<%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();}%>