我需要将 odbc 数据库连接到我的 java 代码。我知道要连接 mdb 数据库,我需要使用此代码,但它不起作用:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
// set this to a MS Access DB you have on your machine
String filename = "C:/porogram/pro.mdb";
String database = "jdbc:odbc:Driver={Microsoft Access Driver(*.mdb)};DBQ=";
database+= filename.trim() + ";DriverID=22;READONLY=true}"; // add on to the end
// now we can get the connection from the DriverManager
Connection con = DriverManager.getConnection( database ,"","");
Statement s = con.createStatement();
非常感谢。