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 之间同步数据的最佳方法是什么?


基础教程推荐
- 如何在 SQL Server 的嵌套过程中处理事务? 2021-01-01
- SQL Server 2016更改对象所有者 2022-01-01
- ERROR 2006 (HY000): MySQL 服务器已经消失 2021-01-01
- Sql Server 字符串到日期的转换 2021-01-01
- 无法在 ubuntu 中启动 mysql 服务器 2021-01-01
- 使用pyodbc“不安全"的Python多处理和数据库访问? 2022-01-01
- SQL Server 中单行 MERGE/upsert 的语法 2021-01-01
- SQL Server:只有 GROUP BY 中的最后一个条目 2021-01-01
- 将数据从 MS SQL 迁移到 PostgreSQL? 2022-01-01
- 在 VB.NET 中更新 SQL Server DateTime 列 2021-01-01