import java.sql.*;
public class dbaccess{
 public static void main(String args[]) throws Exception{
  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  String dburl ="jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=Mobile.mdb";//此为NO-DSN方式
  //String dburl ="jdbc:odbc:odbcName";//此为ODBC连接方式
  Connection conn=DriverManager.getConnection(dburl);
  Statement stmt=conn.createStatement();
  ResultSet rs=stmt.executeQuery("select Top 20 * from MobileSection");
  System.out.println("号段\t地区\t类型\t省份\t区号");
  while(rs.next()){
   System.out.println(rs.getString(1)+"\t"+rs.getString(2)+"\t"+rs.getString(3)+"\t"+rs.getString(4)+"\t"+rs.getString(5));
  }
  rs.close();
  stmt.close();
  conn.close();
 }
}
 
运行结果: ---------- Run Java ---------- 号段 地区 类型 省份 区号 1300566 茂名 广东联通130卡 广东 0668 1300567 茂名 广东联通007卡 广东 0668 1300568 茂名 广东联通007卡 广东 0668 1300569 珠海 广东联通130卡 广东 0756 1300570 惠州 广东联通130卡 广东 0752 1300571 惠州 广东联通130卡 广东 0752 1300572 惠州 广东联通130卡 广东 0752 1300573 惠州 广东联通130卡 广东 0752 1300574 惠州 广东联通130卡 广东 0752 1300575 惠州 广东联通130卡 广东 0752 1300576 珠海 广东联通130卡 广东 0756 1300577 珠海 广东联通130卡 广东 0756 1300578 珠海 广东联通130卡 广东 0756 1300579 珠海 广东联通130卡 广东 0756                                                               来源赛迪