<% @ Page contentType = "text/html; charset = gb2312" %>
<% @ Page import = "java. SQL. *" %>
<Html>
<Body>
<% Class. forName ("com. mysql. jdbc. Driver"). newInstance ();
String url = "jdbc: mysql: // localhost: 3306/testdb? User = root &"
"Password = 123 & useUnicode = true & characterEncoding = 8859_1 ";
Connection conn = DriverManager. getConnection (url );
Statement stmt = conn. createStatement (ResultSet. TYPE_SCROLL_SENSITIVE, ResultSet. CONCUR_UPDATABLE );
String SQL = "select * from test ";
ResultSet rs1_stmt.exe cuteQuery (SQL); %>
<Table> <tr> <td> the content of your first field is: </td>
<Td> the content of your second field is: </td> </tr>
<%
While (rs. next () {%>
<Tr> <td>
<% = Rs. getString (1) %> </td> <td>
<% = Rs. getString (2) %> </td> </tr>
<% }%>
</Table>
<% Out. print ("database operation successful, congratulations"); %>
<% Rs. close ();
Stmt. close ();
Conn. close ();
%>
</Body>
</Html>