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 代码在keil5里变成了这样怎么办啊,文件图像也变了,
  • ¥20 Ue4.26打包win64bit报错,如何解决?(语言-c++)
  • ¥15 clousx6整点报时指令怎么写
  • ¥30 远程帮我安装软件及库文件
  • ¥15 关于#自动化#的问题:如何通过电脑控制多相机同步拍照或摄影(相机或者摄影模组数量大于60),并将所有采集的照片或视频以一定编码规则存放至规定电脑文件夹内
  • ¥20 深信服vpn-2050这台设备如何配置才能成功联网?
  • ¥15 Arduino的wifi连接,如何关闭低功耗模式?
  • ¥15 Android studio 无法定位adb是什么问题?
  • ¥15 C#连接不上服务器,