java.sql.SQL Exception:[Microsoft][ODBC Microsoft Access驱动文件] 找不到文件'(未知的)
2个回答
展开全部
也许是你的ODBC配置错误,我也遇见过,不过后来用Access连接字符串直接连接文件路径就OK啦
//这是2003的连接字符串
// String url =
// "jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=F:/Desktop/文档/word/Student.mdb";
//这是2010的连接字符串
String url = "jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=F:/Desktop/文档/word/Student.accdb";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
Connection connection = DriverManager.getConnection(url);
Statement statement = connection.createStatement();
String sql = "select * from Student";
//这是2003的连接字符串
// String url =
// "jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=F:/Desktop/文档/word/Student.mdb";
//这是2010的连接字符串
String url = "jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=F:/Desktop/文档/word/Student.accdb";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
Connection connection = DriverManager.getConnection(url);
Statement statement = connection.createStatement();
String sql = "select * from Student";
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询