<html>
   <head>
      <title>数据库的操作</title>
   </head>
   <body><font color="blue">
   <center>
   <%@page language = "java"%>
   <%@page import = "java.sql.*"%>
   <%@page contentType = "text/html;charset=gb2312"%>
   <%
      String driver = "org.gjt.mm.mysql.Driver";
      String url = "jdbc:mysql://localhost:3306/family?useUnicode=true&characterEncoding=gb2312";
      String userID = "root";
      String passwd = "";
      String SQL_Qry = "SELECT * FROM birthday";

      try
      {
         Class.forName(driver);
      }
      catch(Exception e)
      {
         out.println("无法载入" + driver + "驱动程序！");
         e.printStackTrace();
      }

      try
      {
         Connection DBcon = DriverManager.getConnection(url,userID,passwd);
         Statement SQL_CMD = DBcon.createStatement();
         ResultSet Qry = SQL_CMD.executeQuery(SQL_Qry);
         out.println("数据库的数据： <br>");
        
         while(Qry.next())
         {
            out.println(Qry.getString(1) + "  ");
            out.println(Qry.getString(2) + "  ");
            out.println(Qry.getString(3) + "  ");
            out.println(Qry.getString(4) + "<br>");
         }
      }
      catch(SQLException SQLe)
      {
         out.println("无法连接至数据库！");
         SQLe.printStackTrace();
      }
   %>
   </center>
   </body>
   </html>


