Java 连接access 使用access文件 不用配置
String url = "jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=mydzsw.mdb"; try { //注意:在Driver 和 (*.mdb)之间有一个空格 Connection con = DriverManager.getConnection(url); Statement sta = con.createStatement(); for (int i = 0; i < 100000; i++) { //耗时1分10秒 sta.execute("insert into Persons VALUES (" + i + ", 'note', '22222', '33333', '44444')"); } ResultSet set = sta.executeQuery("select * from Persons where Id_p = 63145"); //毫秒级 set.next(); System.out.println(set.getString(1)); sta.close(); con.close(); } catch (SQLException ex) { Logger.getLogger(NewClass.class.getName()).log(Level.SEVERE, null, ex); }
?