What is the best way to synchronize data between MS Access and MySQL?(在 MS Access 和 MySQL 之间同步数据的最佳方法是什么?)
问题描述
我在 Windows 机器上有一个访问数据库,我必须将其导入到 linux 网络服务器上的 mysql.此时access dabatbase表导出为文本文件,用ftp自动复制,然后加载到mysql中.
I have an access database on a windows machine, which I must import into mysql on a linux webserver. At the moment the access dabatbase table is exported as a text file, automatically copied with ftp, and then loaded into mysql.
有没有更好的方法可以做到这一点,也许使用 ODBC 连接或其他方式?
Is there a better way to do this, perhaps using an ODBC connection or something else?
限制复制已经存在的信息的最佳方法是什么,即只传输在访问数据库中但尚未在 mysql 中的记录.
What is the best way to limit copying information that is already present, ie to only transfer records that are in the access database but not yet in the mysql one.
access 数据库是由另一个程序处理的,如果我不必对其进行更改,甚至不必打开它,那将是最好的.不可能需要从访问数据库中导入更新的记录.mysql 数据库将是主要来源,一些记录将被删除或更改.我只想导入从未在mysql数据库中的记录,而不是恢复故意删除的记录.
The access database is handled by another program, and it would be best if I did not have to makes changes to it, or even open it. There is no possibility of needing to import updated records from the access database. The mysql database will be the main source, and some records will be deleted or changed. I only want to import records that were never in the mysql database, not restore the ones that were purposefully deleted.
推荐答案
为什么不按照 Keltia 的建议通过 ODBC 链接表,然后使用一系列查询来添加丢失的记录并更新更改的记录.查询可以通过 VBA 运行.ADO 也可以很好地与 MySQL 和 Access 配合使用.
Why not link the tables through ODBC as suggested by Keltia, and then use a series of queries to add records that are missing and to update changed records. The queries can be run through VBA. ADO will also work well with MySQL and Access.
关于 Access 中使用的代码的一些说明:
Some notes on code used in Access:
Set db = CurrentDb
strSQL = "Insert INTO [ODBC;DSN=DSNName;].NameOfMySQLTable " _
& "Select AnyField As NameOfMySQLField FROM AnyAccessTable;"
db.Execute strSQL, dbFailOnError
End Sub
-- http://forum.lessthandot.com/viewtopic.php?f=95&t=3862
这篇关于在 MS Access 和 MySQL 之间同步数据的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 MS Access 和 MySQL 之间同步数据的最佳方法是什么?


- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- 导入具有可变标题的 Excel 文件 2021-01-01
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01
- 更改自动增量起始编号? 2021-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01
- SQL 临时表问题 2022-01-01
- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01