dongyu5482 2011-01-21 09:32
浏览 83
已采纳

在PHP中将Firebird与MySQL同步

I have two databases, one is a Firebird database, other is a MySQL database.

Firebird database is the main one where the information changes. I have to synchronize those changes to the other MySQL database.

I have no control over the Firebird one - I can just SELECT from it. I cannot add triggers, events or similar. I have all the control on the MySQL database.

The synchronization has to be done through 'internet' as these two servers are not connected in any way and are on different locations.

Synchronization has to be done in PHP on the server that also hosts the MySQL database.

Currently I just go through every record (every 15 minutes), calculate the hash of the rows, compare two hashes and if they don't match, I update the whole row. It works but just seems very wrong and not optimized in any way.

Is there any other way to do this? I am missing something?

Thank you.

  • 写回答

1条回答 默认 最新

  • duandi1636 2011-01-21 10:09
    关注

    I have made the same thing once and I don't think there is a generaly better solution.

    You can only more or less optimize what you have so far. For example:

    • If some of the tables have a column with the "latest update" information, you can select only those that were changed since the last sync.
    • You can change the comparison mechanism - instead of comparing and updating whole rows, you can compare individual columns and on the MySQL side update only the changed ones. I believe that it would speed things up in case of MyISAM tables, but probably not if you use InnoDB.
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 R语言卸载之后无法重装,显示电脑存在下载某些较大二进制文件行为,怎么办
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?
  • ¥15 关于#vue.js#的问题:修改用户信息功能图片无法回显,数据库中只存了一张图片(相关搜索:字符串)
  • ¥15 texstudio的问题,
  • ¥15 spaceclaim模型变灰色
  • ¥15 求一份华为esight平台V300R009C00SPC200这个型号的api接口文档
  • ¥15 字符串比较代码的漏洞
  • ¥15 欧拉系统opt目录空间使用100%
  • ¥15 ul做导航栏格式不对怎么改?