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 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵