<%
Class.forName("com.mysql.jdbc.Driver");
connection conn=DriverManager.getConnection("jdbc:MySQL://localhost:3306/test", "root", "password");
Statement stmt=conn.createStatement();
resultset rs=stmt.executeQuery("select * FROM table_name");
while (rs.next()) {
out.println(rs.getstring("col1"));
}
rs.close();
stmt.close();
conn.close();
%>
还没有评论,来说两句吧...