多个用户可以同时使用Java连接到Microsoft Access数据库吗?

时间:2021-02-17 12:47:03

The question is pretty self-explanatory, but below is some more info about the situation:

这个问题不言自明,但下面是一些关于情况的信息:

I am building a Java program that will be replacing a program that consists of an Excel user interface with an Access database. The Excel program connects to the Access database and communicates with VBA. But, so far there has only ever been one user at a time. Now that the program is due to expand, we need many users to be able to write to any table at the same time.

我正在构建一个Java程序,它将用一个Access数据库替换一个由Excel用户界面组成的程序。Excel程序连接到Access数据库并与VBA通信。但是,到目前为止,一次只有一个用户。现在,该程序即将展开,我们需要许多用户能够同时编写任何表。

Access allows multiple users to connect at once, of course. This is not possible in HSQLDB, which is what prompted the question. Obviously, this is better accomplished with a server, but the plan is to build the program using the current database and then accomplish the transition to a server later.

当然,访问允许多个用户同时连接。这在HSQLDB中是不可能的,这正是引发问题的原因。显然,使用服务器可以更好地实现这一点,但是计划是使用当前数据库构建程序,然后稍后完成到服务器的转换。

Thanks in advance

谢谢提前

2 个解决方案

#1


1  

In order to support multiple concurrent users (processes) writing to an Access database you must use the Access Database Engine. The options to do that from a Java application are:

为了支持向访问数据库写入的多个并发用户(进程),必须使用访问数据库引擎。从Java应用程序中实现这一点的选项是:

  1. Use Java's own JDBC-ODBC Bridge and the Access ODBC driver. (Note that the JDBC-ODBC Bridge was removed from Java 8.)

    使用Java自己的JDBC-ODBC桥接和访问ODBC驱动程序。(注意,从Java 8中删除了JDBC-ODBC桥。)

  2. Use a third-party JDBC-ODBC Bridge and the Access ODBC driver.

    使用第三方JDBC-ODBC桥接器和访问ODBC驱动程序。

  3. Use a third-party JDBC driver that works with the Access Database Engine (if such a thing exists).

    使用与Access数据库引擎一起工作的第三方JDBC驱动程序(如果存在的话)。

Note especially that the UCanAccess JDBC driver does not use the Access Database Engine and therefore does not support multiple concurrent users (processes) writing to the Access database.

请特别注意,UCanAccess JDBC驱动程序不使用Access数据库引擎,因此不支持向Access数据库写入多个并发用户(进程)。

#2


0  

You can do it. I have a similar application that I use. In version 1.8 of Java, the ODBC bridge was removed, so you'll have to look into using a separate library to connect, assuming you are using 1.8 or above. For me, it's way slower, but it does work. check out Removal of JDBC ODBC bridge in java 8 I use "Ucanaccess" for my program, which is one of the suggestions in that question.

你能做到。我有一个类似的应用程序。在Java 1.8版本中,ODBC桥被移除,因此您必须考虑使用一个单独的库进行连接,假设您正在使用1.8或更高版本。对我来说,它的速度要慢得多,但它确实有用。在java 8中删除ODBC JDBC桥接,我在程序中使用“Ucanaccess”,这是问题中的一个建议。

#1


1  

In order to support multiple concurrent users (processes) writing to an Access database you must use the Access Database Engine. The options to do that from a Java application are:

为了支持向访问数据库写入的多个并发用户(进程),必须使用访问数据库引擎。从Java应用程序中实现这一点的选项是:

  1. Use Java's own JDBC-ODBC Bridge and the Access ODBC driver. (Note that the JDBC-ODBC Bridge was removed from Java 8.)

    使用Java自己的JDBC-ODBC桥接和访问ODBC驱动程序。(注意,从Java 8中删除了JDBC-ODBC桥。)

  2. Use a third-party JDBC-ODBC Bridge and the Access ODBC driver.

    使用第三方JDBC-ODBC桥接器和访问ODBC驱动程序。

  3. Use a third-party JDBC driver that works with the Access Database Engine (if such a thing exists).

    使用与Access数据库引擎一起工作的第三方JDBC驱动程序(如果存在的话)。

Note especially that the UCanAccess JDBC driver does not use the Access Database Engine and therefore does not support multiple concurrent users (processes) writing to the Access database.

请特别注意,UCanAccess JDBC驱动程序不使用Access数据库引擎,因此不支持向Access数据库写入多个并发用户(进程)。

#2


0  

You can do it. I have a similar application that I use. In version 1.8 of Java, the ODBC bridge was removed, so you'll have to look into using a separate library to connect, assuming you are using 1.8 or above. For me, it's way slower, but it does work. check out Removal of JDBC ODBC bridge in java 8 I use "Ucanaccess" for my program, which is one of the suggestions in that question.

你能做到。我有一个类似的应用程序。在Java 1.8版本中,ODBC桥被移除,因此您必须考虑使用一个单独的库进行连接,假设您正在使用1.8或更高版本。对我来说,它的速度要慢得多,但它确实有用。在java 8中删除ODBC JDBC桥接,我在程序中使用“Ucanaccess”,这是问题中的一个建议。