try
{
    Connection conn = DriverManager.getConnection"jdbc:odbc:ChatHistory2");
    Statement stmt = conn.createStatement();
    String sql = "SELECT Name, Date, Content FROM Chat";
    ResultSet rs = stmt.executeQuery(sql);
    
   int iCountRow = 0;
   while(rs.next())
  {
      sName = rs.getString("Name");
      sDate = rs.getString("Date");
      sContent = rs.getString("Content");
      //  显示数据
      table.add
      table.setValueAt(sName,iCountRow,0);
      table.setValueAt(sDate,iCountRow,1);
      table.setValueAt(sContent,iCountRow,2);
      iCountRow++;
  }

  rs.close();
  stmt.close();
  conn.close();
}
catch(Exception e)
{
   e.printStackTrace();
}