我有此代码可以使用 UCanAcess 库连接到 Access 数据库。
public Visualizzazioni_Access() {
try {
log=new MyLog4J();
File dbFile = new File("CassaGestionale.accdb");
String path = dbFile.getAbsolutePath();
db=DriverManager.getConnection("jdbc:ucanaccess://"+path);
connesso=true;
System.out.println("Connection Succesfull");
} catch (Exception e) {
connesso=false;
log.logStackTrace(e);
}
}
代码有效,所以当我尝试连接时我收到此调试消息?到底是不是错误?
DEBUG [AWT-EventQueue-0] (DatabaseImpl.java:831) - Finished reading system catalog. Tables: [CodScontrini, Scontrini]
WARNING:Error in the metadata of the table CodScontrini: table's row count in the metadata is 373 but 374 records have been found and loaded by UCanAccess. All will work fine, but it's better to repair your database.
WARN [AWT-EventQueue-0] (IndexData.java:328) - unsupported data type BINARY for index, making read-only
Connection Succesfull
最佳答案
这是因为实际找到的记录数与名为“CodScontrini”的表的元数据中注册的记录数之间存在不一致。 这不会导致问题,但使用Compact and Repair Database Access 中的功能可以轻松地将表元数据从之前有一定程度损坏的状态恢复到正确的状态。
关于java - 如何通过 Java 8 修复 Access DB 连接中的表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28146708/