简体   繁体   English

如何使用Jackcess在Access .mdb中创建ODBC链接表?

[英]How can I create an ODBC linked table in an Access .mdb using Jackcess?

I'm trying to create ODBC linked table in an Access .mdb using Jackcess. 我正在尝试使用Jackcess在Access .mdb中创建ODBC链接表。

Final String connStr = "ODBC;DRIVER={Sybase ASE ODBC Driver};NA=dbhostname,port;DB=myDbName;UID=myID;PWD=myPass;FILEDSN=path//myDSN.dsn";

Database mdb =Database.create(new File("./test.mdb");
mdb.createLinkedTable("testLinkTable",connStr, "targetTableName");

when I open test.mdb, I can see "testLinkTable", but type of link is "Access Link". 当我打开test.mdb时,我可以看到“testLinkTable”,但链接类型是“Access Link”。 I'm expecting to create "ODBC Link" table in test.mdb. 我期待在test.mdb中创建“ODBC Link”表。

Could somebody kindly show me the right way to accomplish this? 有人可以告诉我正确的方法吗?

It appears that the .createLinkedTable() method in Jackcess is currently only able to create links to tables in another Access database. 看来.createLinkedTable()中的.createLinkedTable()方法目前只能创建到另一个Access数据库中的表的链接。 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: 我刚刚使用Jackcess 2.0.1对此进行了测试,并且以下代码成功创建了一个名为[Clients]的Access链接表,该表指向另一个Access数据库:

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: 但是,此代码创建了一个名为[dbo_Addresses]的链接表,它看起来像是指向另一个Access数据库的链接(不是预期的ODBC链接表),并且不起作用:

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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用Jackcess删除(DROP)Access表 - How to delete (DROP) an Access table using Jackcess 如何使用Java和Jackcess从Linux机器访问共享文件夹中的远程.mdb文件 - How to access the remote .mdb file in shared folder using java and jackcess from linux machine 使用Java / Jackcess从加密的Access .mdb中读取 - Reading from an encrypted Access .mdb using Java / Jackcess 我在哪里使用Jackcess ..把.mdb数据库文件放在哪里? - Where do i put the .mdb database file using Jackcess..? 如何从ftp位置jackcess打开.mdb - how to open .mdb from ftp location jackcess 使用odbc-:java中的数据库连接:找不到Microsoft Access驱动程序(* .mdb * .accdb)选项 - Database connectivity in java using odbc-: can't find microsoft access driver (*.mdb *.accdb) option 使用Jackcess从Access表中删除特定行 - Delete specific rows from an Access table using Jackcess 如何使用Java jdbc-odbc网桥从* .mdb文件获取表名? - How to get the table names from a *.mdb file using java jdbc-odbc bridge? 使用Java,如何列出和打印MS-Access 2003 mdb文件中的所有查询? - Using Java, How can I list and print all Queries in a MS-Access 2003 mdb file? 我必须使用SQL-Statement中的哪个通配符进行Access * .mdb文件查询(使用Java和JDBC:ODBC桥) - Which wildcard in SQL-Statement do I have to use for an Access *.mdb-file query (using Java & JDBC:ODBC bridge)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM