如何在线同步离线数据库 [英] How to sync online & offline databases

查看:216
本文介绍了如何在线同步离线数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网络应用,可为我的客户提供一些信息。我有另一个版本( windows ),它与Web应用程序完全相同 c。

I have a web application which provide some information for my customers. I have another version (windows) that exactly work same as web application.

这是因为Web连接可能会丢失几个小时,并且此时用户将要使用该应用程序。

This is because Web connection may lost for some hours and in this time user is going to use the application.

我想知道如何同步这些 SQL Server 数据库。

I'm wonder how to sync these SQL Server databases.

请注意,网络应用程序使用的是来自 3个不同城市的都有基于Windows的应用程序。我该怎么办?

Note that web application is using from 3 different cities and all of them have a windows based application too. What should I do?

NoteL Windows verision正是Web应用程序,它安装在3个不同城市的Local Web Server中,用户可以通过其<$ c $访问它们c> LAN

NoteL windows verision is exactly web application which installed in the Local Web Server in 3 different cities and users have access to them via their LAN.

推荐答案

数据中的所有更新至from /到Web / Windows,将源自Windows应用程序。但是问题是Windows应用程序会在没有互联网连接的情况下运行。

All updates in data to from/to web/windows would originate from the windows application. But the problem is that the windows app will run when there is no internet connection.

因此,您将不得不使用Windows服务,该服务将为本地和远程调用Web服务数据库更新。 Windows可以每隔x分钟唤醒一次,并更新远程和本地数据库。

So you will have to use a windows service which will call a webservice for local and remote database updates. The windows can wake up every x mins and update the remote and local databases.

该Web服务将有两种方法:

The webservice will have two methods:

GetData(DateTime getRecordsFromThisDate) - Windows service should call this on regular intervals and update the local database.

UploadData(dataRows/collection) -  Windows service should call this on regular intervals and update the remote database.

数据库中的每个记录都会有一个时间戳。对于本地更新,获取最大的时间戳并将其作为参数发送到GetData()。 Web服务将返回在此时间之后创建的记录。

Each record in database will have a timestamp. For local update, get the largest timestamp and send it as parameter to GetData(). The webservice will return the records created after this time.

对于上载数据,您将必须存储上次成功执行上载操作的时间。在此时间之后获取(插入和更新的)记录,并将其发送到UploadData()。

For upload data, you will have to store the last time when an successful upload operation was run. Get the records(inserted and updated) after this time and send them to UploadData().

这篇关于如何在线同步离线数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆