Further to:
http://sourceforge.net/p/ucanaccess/discussion/help/thread/85e8e178/
If an .accdb file
then trying to use Database#getTable on the linked table results in a NullPointerException:
public static void main(String[] args) {
try (Database db = DatabaseBuilder.open(new File("C:/Users/Public/test/linked.accdb"))) {
Table tbl = null;
try {
tbl = db.getTable("Table1");
} catch (NullPointerException npe) {
System.err.println("*** ERROR - .getTable threw NullPointerException:");
npe.printStackTrace(System.err);
System.exit(0);
}
for (Row r : tbl) {
System.out.println(r.getString("TextField"));
}
} catch (Exception e) {
e.printStackTrace(System.err);
}
}
result:
*** ERROR - .getTable threw NullPointerException:
java.lang.NullPointerException
at java.io.File.<init>(File.java:277)
at com.healthmarketscience.jackcess.util.LinkResolver$1.resolveLinkedDatabase(LinkResolver.java:42)
at com.healthmarketscience.jackcess.impl.DatabaseImpl.getTable(DatabaseImpl.java:956)
at com.healthmarketscience.jackcess.impl.DatabaseImpl.getTable(DatabaseImpl.java:900)
at com.healthmarketscience.jackcess.impl.DatabaseImpl.getTable(DatabaseImpl.java:80)
at com.example.jackcesstest.ComExampleJackcesstest.main(ComExampleJackcesstest.java:27)
Changing the sort order of the database file to "General" or "General - Legacy" avoids the error.
Fixed in trunk, will be in the 2.1.1 release.