ACCESSJAVA 连接ACCESS

String  ur1 = "jdbc:odbc:Driver={Microsoft Access Driver(*.mdb)};DBQ=D:\\JAVA\\workspace\\MobileSchedule\\Schedule.mdb";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection(ur1, "", "");
Statement sql = con.createStatement();
String sqlStr = "insert into Schedule values(" + year + ", " + month + " ," + day + " ," + hour + ", "
                + minter + ", " + timeout + ",’" + data + "’)";
System.out.println(sqlStr);
sql.executeUpdate(sqlStr);
con.close();

  1. 内需在控制面板=>管理工具=>数据源(ODBC)=>用户DSN中插入MS
    Access Database数据源

2.插入更新删除要接纳sql.executeUpdate,而毫不挑选sql.executeQuery…

java连接access老是失误

ACCESS,先贴上科学的代码

 

内需专注的题材:

仅当提示!!!!

相关文章