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.
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料