仅供学习研究使用,切勿用于商业
示例代码 d:/reyo.mdb 为access的mdb文件路径
public static void main(String[] args) throws SQLException, ClassNotFoundException {
String url ="jdbc:access:/d:/reyo.mdb";
Class.forName("com.hxtt.sql.access.AccessDriver");
Connection con = DriverManager.getConnection(url);
Statement statement = con.createStatement();
statement.execute("drop table if exists test;");
statement.execute("create table if not exists test(field1 varchar(25),field2 varchar(25),field3 varchar(25),field4
varchar(25),field5 varchar(25),field6 varchar(25))");
for(int i=0;i<10000;i++){
statement.execute("insert into test(field1,field2,field3,field4,field5,field6) values('field1_"+i+"','field2_"+i+"','field3_"+i+"','field4_"+i+"','field5_"+i+"','filed6_"+i+"')");
}
ResultSet rs= statement.executeQuery("select * from test");
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)+"\t"+rs.getString(6));
}
con.close();
}
1