none
c#Oracle数据同步到mysql RRS feed

全部回复

  • 你好,

    方法一、

    你可以写一个 windows service 做轮询, 每隔一段执行一次同步方法。同步方法就是查询oracle, 比较后再写入MySQL 数据库。(此法不能做到及时同步, 有一定时间间隔)。

    方法二、

    可以写一个WCF的服务, 操作Oracle 的时候, 可以调用WCF 服务来更新MySQL 数据库。

    Best Regards,

    Cole Wu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    2017年2月21日 7:56
    版主
  • 其实我想问的是c#怎么把oracle的数据导入到Mysql中,我现在是把oracle的数据写入到XML中,然后准备再把XML的数据导入到Mysql中,有好一点的办法吗?

    please verify my account

    2017年2月22日 0:17
  • 你好,

    如果用c#写的话, 也是使用读取oracle 的数据到dataset 中,再插入到MYSQL 中。

    Best regards,

    Cole Wu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    2017年2月22日 1:33
    版主
  • 请问c#怎么把dataset插入到mysql中,有没有例子参考一下啊

    please verify my account

    2017年2月22日 2:06
  • 你好,

    这个一个SQL server 的例子, 使用DataAdapter.Update 方法来做的,你可以参考一下。

    IDbTransaction dbTransaction = dbConnection.BeginTransaction();
    try
    {
      foreach (DataTable dataTable in dataSet.Tables)
      {
        string sql = "SELECT * FROM " + dataTable.TableName + " WHERE 0 = 1";
        SqlDataAdapter dataAdapter = new SqlDataAdapter (sql, dbConnection);
        dataAdapter.Update(dataSet, dataTable.TableName);
      }
    }
    catch
    {
      dbTransaction.Rollback();
      throw;
    }
    dbTransaction.Commit();

    Best regards,

    Cole Wu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    2017年2月22日 6:28
    版主