/*ch0803.java*/
import java.sql.*;
public class ch0803
{
  public static void main(String args[])
  {
    Connection con;
    Statement sql;
    ResultSet rs;
    try
    {
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    }
    catch(ClassNotFoundException e)
    {
      System.out.println(e);
    }
    try
    {
      con=DriverManager.getConnection("jdbc:odbc:MydataSource","la","1234");
      sql=con.createStatement();
      String s="SELECT 姓名,生日  FROM student ORDER BY 生日  ASC";
      rs=sql.executeQuery(s);
      while(rs.next())
      {
        String name=rs.getString(1);
        Date birth=rs.getDate(2);
        System.out.println("姓名："+name);
        System.out.println("生日"+birth);
      }
    }
    catch(SQLException e)
    {
      System.out.print(e);
    }
  }
}
