It appears that the .createLinkedTable()
method in Jackcess is currently only able to create links to tables in another Access database. I just tested this with Jackcess 2.0.1 and the following code successfully created an Access linked table named [Clients] that points to another Access database:
Database database = DatabaseBuilder.open(new File("C:\\__tmp\\jTest\\linkTest.accdb"));
String linkedTableLocalName = "Clients";
String linkedTableSource = "C:\\Users\\Public\\Database1.accdb";
String linkedTableRemoteName = "Clients";
database.createLinkedTable(linkedTableLocalName, linkedTableSource, linkedTableRemoteName);
However, this code created a linked table named [dbo_Addresses] that looked like a link to another Access database (not an ODBC linked table as intended) and did not work:
Database database = DatabaseBuilder.open(new File("C:\\__tmp\\jTest\\linkTest.accdb"));
String linkedTableLocalName = "dbo_Addresses";
String linkedTableSource = "ODBC;DSN=myDb;Trusted_Connection=Yes;APP=Microsoft Office 2010;DATABASE=myDb;";
String linkedTableRemoteName = "dbo.Addresses";
database.createLinkedTable(linkedTableLocalName, linkedTableSource, linkedTableRemoteName);