如何在Java中以编程方式读取MS Access(.mdb)文件?

huangapple 未分类评论48阅读模式
英文:

How to programmatically read a MS Access (.mdb) file in java?

问题

我正在对一个旧的、去中心化的、本地应用进行维护,每个客户都使用自己独立的.mdbMS Access)文件作为数据库。我们正在开发一个新的、集中化的SpringBoot Web应用,该应用使用MySQL作为数据库。问题是,我们不能简单地丢弃已有的Access数据库中的数据,因此,新应用的一个先决条件是添加一个功能,将所有旧数据从这些.mdb文件迁移到新数据库中。

具体来说,通过HTTP调用,我们的客户应该能够通过SpringBoot控制器发送一个.mdb文件。然后,服务器应读取表及其内容,验证一些信息,并将读取的数据插入新的MySQL数据库中。

一些注意事项:
最新版本的数据库结构 - 即MySQL - 当然是已知的,但旧的Access数据库的结构可能会有所不同,因为并不是所有客户都有旧应用/MS Access的最新版本。因此,如果可能的话,读取过程应该是动态的,不依赖于预先确定的结构。好消息是,一般情况下,更新的版本只会添加新的表格和字段(没有删除或编辑),因此在迁移非常旧的.mdb时,可能会缺少一些表格和字段(这应该不是问题,除非它们是“NOT NULL”),但至少不会有“新”的、未知的或额外的字段。

HTTP控制器、数据验证和插入都没问题,但我找不到如何以编程和动态的方式读取.mdb文件。对于此问题,任何帮助将不胜感激。提前感谢您!

英文:

I am giving maintenance on an old, decentralized, and local application that each of our Clients uses, with each app having its own independent .mdb (MS Access) file as a database. We are developing a new, centralized SpringBoot Web application that uses MySQL as a database. The problem is that we can't just throw away the data on the already existing Access databases, therefore, one of the pre-requisites for the new application is to add a function to migrate all the old data from those .mdb files into the new database.
In detail, using an HTTP call, our client should be able to send a .mdb file through a SpringBoot controller. The Server should then read the tables and its contents, validate a few pieces of information, and insert the data read on the new MySQL database.

A few notes:
The most recent version of the database structure -the MySQL- is, of course, already known, but the structures of the older Access databases may vary, as not all of the Clients have the most up to date version of the old App/MS Access. That's why, if possible, the reading process should be dinamic and independent of a pre-determined structure. The good news is that, in general, the newer versions only add new tables and fields (no deletions nor editions), therefore when migrating a very old .mdb, a few tables and fields could be missing (shouldn't be a problem, except it's 'NOT NULL'), but at least there will be no "new", unknown or extra field.

The HTTP Controller, the validation, and insertion of the data are OK, but I couldn't find how to programmatically and dynamically read the .mdb file. Any help would be appreciated. Thanks in advance!

huangapple
  • 本文由 发表于 2020年7月26日 06:45:30
  • 转载请务必保留本文链接:https://java.coder-hub.com/63094329.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定