我正在尝试使用ucanaccess(4.0.2)jar访问MS Access 2016(.accdb)文件,代码为:
public class Test {
static String path ="*****/src/main/resources/TestDatabase.accdb"; //absolute path to my access file
public static void main(String[] args) throws ClassNotFoundException, SQLException {
Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");
Connection conn = DriverManager.getConnection("jdbc:ucanaccess://"+path);
}
我收到以下异常:
Exception in thread "main" net.ucanaccess.jdbc.UcanaccessSQLException: UCAExc:::4.0.2 Unsupported newer version: 5
at net.ucanaccess.jdbc.UcanaccessDriver.connect(UcanaccessDriver.java:264)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:270)
at db.Test.main(Test.java:29)
Caused by: java.io.IOException: Unsupported newer version: 5
at com.healthmarketscience.jackcess.impl.JetFormat.getFormat(JetFormat.java:293)
at com.healthmarketscience.jackcess.impl.DatabaseImpl.<init>(DatabaseImpl.java:517)
at com.healthmarketscience.jackcess.impl.DatabaseImpl.open(DatabaseImpl.java:400)
at com.healthmarketscience.jackcess.DatabaseBuilder.open(DatabaseBuilder.java:252)
at net.ucanaccess.jdbc.DefaultJackcessOpener.open(DefaultJackcessOpener.java:35)
at net.ucanaccess.jdbc.DBReference.<init>(DBReference.java:161)
at net.ucanaccess.jdbc.DBReferenceSingleton.loadReference(DBReferenceSingleton.java:51)
at net.ucanaccess.jdbc.UcanaccessDriver.connect(UcanaccessDriver.java:98)
... 3 more
使用的Maven依赖:
任何帮助都将不胜感激。
感谢。
答案 0 :(得分:1)
Jackcess将支持2.1.10版本中的Access 2016数据库(更改目前处于主干,但尚未发布)。
答案 1 :(得分:0)
它适用于我的情况:))
答案 2 :(得分:0)
我遇到了同样的错误。我已升级到jackcess-3.0.1,现在已解决。