/*ch0802.java*/
import java.sql.*;
public class ch0802
{
  public static void main(String args[])
  {
    Connection con;
    Statement sq1;
    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");
      sq1=con.createStatement();
      rs=sq1.executeQuery("SELECT*FROM student");
      while (rs.next())
      {
        String xuehao=rs.getString(1);
        String xingming=rs.getString(2);
        String xingbie=rs.getString(3);
        Date shengri=rs.getDate(4);
        System.out.println("学号："+xuehao);
        System.out.println("姓名："+xingming);
        System.out.println("性别："+xingbie);
        System.out.println("生日："+shengri);
      } 
      con.close();
    }
    catch(SQLException e)
    {
      System.out.print(e);
    }
  }
}
