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 宇视监控服务器无法登录
  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥15 DruidDataSource一直closing
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥50 power BI 从Mysql服务器导入数据,但连接进去后显示表无数据