同步Access DB和MySQL

发布于 2024-09-06 08:08:12 字数 261 浏览 3 评论 0原文

我有一个客户,他有一个使用 Access 的非常大的内部系统,该系统在内部用于处理几乎所有公司数据。他们想要该数据库中的客户数据的 Web 前端,并且将在不同的服务器上运行。鉴于 Access 的限制,前端可能会使用 MySQL。

这就留下了数据同步的问题。它不需要精确到秒,甚至每天都可以,但我真的不确定这样做的好方法。

考虑到现有系统的范围,将整个系统迁移到另一个数据库(例如 MySQL)将花费不成比例的时间和工作量。

有什么实际的方法可以实现这一点吗?

I've got a client who has a very large internal system using Access, which is used internally to handle virtually all company data. They want a web front-end to the customer data in that database, and would be running on a different server. Given the limitations on Access, the front-end would likely use MySQL.

Which leaves the issue of synchronizing the data. It doesn't need to be to-the-second, even daily would be fine, but I'm really unsure of a good means of doing this.

Given the scope of the existing system, it would be a disproportionate amount of time and work to move the entire system to another database such as MySQL.

Is there any practical way to accomplish this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

最后的乘客 2024-09-13 08:08:12

我的“同步”步骤更像是超快速备份

1.- 在 Windows 中用它转换数据库,

http://www.bullzip.com/products/a2m/info.php

它可以将大部分数据库快速转换为 YOURDATABASE.sql

2.- 在 Linux 中(我使用 Ubuntu),

因为你必须经常这样做,我推荐一个脚本以便更正。

我的例子:

#!/bin/bash
#edita tablas
szAnswer=$(zenity --title="YOURDATABASE" --entry --text "some text" --entry-text "");
fromdos $szAnswer;
sed -i 's/DATETIME\ DEFAULT\ .*/DATE,/g' $szAnswer;
sed -i 's/DATETIME/DATE/g' $szAnswer;
sed -i 's/FLOAT/DECIMAL(10,2)/g' $szAnswer;
sed -i 's/(NULL,/(\ ,/g' $szAnswer;
sed -i 's/ NULL);/\ );/g' $szAnswer;
sed -i 's/,\ NULL,/,\ ,/g' $szAnswer

zenity 程序是 ubuntu 中的默认程序
您需要“fromdos”在 Windows 中进行回车,

然后:
3.- mysql -u theuser -pthepass

mysql>source YOURDATABASE.sql

大约 5 分钟内即可完成。

my steps to "sync" more like superfast backup

1.- in windows convert your database with this

http://www.bullzip.com/products/a2m/info.php

it converts fast most of database into YOURDATABASE.sql

2.- in linux (I use Ubuntu)

since you must do this often i recomend a script for corrections.

example of mine:

#!/bin/bash
#edita tablas
szAnswer=$(zenity --title="YOURDATABASE" --entry --text "some text" --entry-text "");
fromdos $szAnswer;
sed -i 's/DATETIME\ DEFAULT\ .*/DATE,/g' $szAnswer;
sed -i 's/DATETIME/DATE/g' $szAnswer;
sed -i 's/FLOAT/DECIMAL(10,2)/g' $szAnswer;
sed -i 's/(NULL,/(\ ,/g' $szAnswer;
sed -i 's/ NULL);/\ );/g' $szAnswer;
sed -i 's/,\ NULL,/,\ ,/g' $szAnswer

zenity program is default in ubuntu
you need "fromdos" for carriage returns in windows

then :
3.- mysql -u theuser -pthepass

mysql>source YOURDATABASE.sql

and you are done in about 5 mins.

为你拒绝所有暧昧 2024-09-13 08:08:12

从 Access 中可以相当轻松地复制内容,例如使用运行 SQL 查询的按钮将数据复制到 Internet 上的 MS-SQL 数据库。

如果不需要,我不会选择 MySQL,因为这会引入字符编码问题,复制到 MS-SQL 更明智。

当然要非常小心,您将拥有 3 个系统:1 个访问系统、1 个 Web 系统和 1 个用于复制数据的系统。这种情况会带来更高的维护成本。

From Access it is possible to fairly easy copy content, for example using a button that runs a SQL query that copies the data to an MS-SQL database on internet.

I wouldn't go for MySQL if you don't have to as this introduces character encoding issues, copying to MS-SQL is more sensible.

Be very wary of course, you are going to have 3 systems: 1 access system, 1 web system and 1 system for copying data. This scenario is and introduces higher maintenance costs.

诠释孤独 2024-09-13 08:08:12

我会找一位经验丰富的 Access 开发人员来扩大 Access 应用程序的规模,以使用 SQL Server Express 而不是 MySQL 来存储数据。我会选择 SQL Server Express 而不是 MySQL,因为它很可能与 Access 配合使用效果更好,并且您可能会发现对 MS Access 和 SQL Server 组合的在线支持比对 MS Access 和 MySQL 的在线支持更多。

对于有经验的人来说,这项工作可能需要几周或更长时间。当然,系统越大,所需的时间就越长。

其中一个因素是客户是否希望数据从网站下载到数据库或只是将数据发布到网络?如果只是发布到网络,那么使用查询更新网络数据库的建议可能会起作用。如果这两种方式都是如此,那么事情就会开始变得更加棘手,并且在未来升级到 SQL Server 将是一个更好的选择。

I would get an experienced Access developer to upsize the Access application to use SQL Server Express for the data instead of MySQL. I would choose SQL Server Express over MySQL is it is very likely to work better with Access and you'll likely find a lost more online support for the combination of MS Access and SQL Server than you would for MS Access and MySQL.

This work can take several weeks or more for an experienced person. And of course the larger the system the longer this will take.

One factor is if the client wants data to come down from the website to the database or just publish data to the web? If just publishing to the web then the suggestion of updating the web database using queries could work. If both ways then things start to get trickier and upsizing to SQL Server for the future would be a better option.

终止放荡 2024-09-13 08:08:12

如果可以在 Access 用户所在的本地 LAN 上访问 Web 数据库,则将后端升级为服务器数据库并拥有单个数据库会更有意义。但情况可能并非如此,因为 Web 服务器可能不是本地的(这通常是一件好事)。

如果我理解你的评论,这是一个明确的主/从关系,Access 数据库是主数据库,网站数据库是从数据库。在这种情况下,您应该能够简单地定期更换网站数据库。有几种方法可以做到这一点:

  1. 如果您可以通过 Internet 访问 MySQL 端口,则可以使用 ODBC 通过 ODBC 将表导出到 MySQL。我不确定在导出之前是否必须删除 MySQL 中的每个表,但是一旦尝试运行导出,您就会发现。

  2. 如果您无法直接连接到远程数据库,那么一种选择是运行本地 MySQL 实例,导出到,然后将数据库转储到 SQL 脚本,上传该脚本到网站并运行它来替换现有的数据库。我已经做到了,这并不像听起来那么困难。如果不需要自动化,最简单的方法可能是在两端安装 phpMyAdmin 并使用它。如果需要自动化,那就是另一个问题了,我不知道 MySQL 命令,但我确信找到这些命令并不难。

If the web database is accessible on the local LAN where the Access users are, it would make more sense to upsize the back end to a server database and have a single database. But that's likely not the case, as the web server is probably not local (and this is usually a good thing).

If I'm understanding your comments, this is a clear master/slave relationship, with the Access database being the master, and the website database being a slave. In that case, you should be able to simply replace the website database on a regular basis. There are a couple of ways to do this:

  1. if you can get access to the MySQL port across the Internet, you can use ODBC to simply export the tables to MySQL, via ODBC. I'm not sure if you'd have to drop each table in MySQL before exporting, but you'd find out as soon as you tried to run the export.

  2. if you can't get a direct connection to the remote database, then one option is to run a local MySQL instance, export to it, then dump the database to a SQL script, upload that to the website and run it to replace the existing database. I've done this and it's not as difficult as it sounds. If it doesn't need to be automated, it might be easiest to install phpMyAdmin on both ends and use that. If it needs to be automated, that's a different issue, and I don't know the MySQL commands, but I'm sure it's not that hard to locate the commands.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文