[英]Transfer data from remote server database into local database daily
I have access to (to-be-developed) web service that can return data from a remote database. 我可以访问(待开发)Web服务,该服务可以从远程数据库返回数据。
The consumer for the data is a Windows/.NET application that needs to insert that data into the local database (not necessarily SQL Server). 数据的使用者是Windows / .NET应用程序,需要将数据插入本地数据库(不一定是SQL Server)。
This syncing is one-way only -> from server to local database. 这种同步是单向的->从服务器到本地数据库。 Local database however can have more data (inserted locally through the .NET application) than the server database. 但是,本地数据库比服务器数据库具有更多的数据(通过.NET应用程序本地插入)。
How can I achieve that kind of data transfer? 如何实现这种数据传输? Some specific questions I have now: 我现在有一些具体的问题:
You should use windows services to perform above task . 您应该使用Windows服务执行上述任务。 You can schedule windows service to run once in a day to import data from remote database server to local server. 您可以计划Windows服务每天运行一次,以将数据从远程数据库服务器导入本地服务器。
You have to write your own logic to determine which data is present at local database and than import the data which is not present in local data store. 您必须编写自己的逻辑来确定本地数据库中存在哪些数据,然后导入本地数据存储中不存在的数据。 You have to write all this logic in wndows service only. 您只需要在wndows服务中编写所有这些逻辑。
1)You can have windows service or console application better is to go with windows service for following reasons:- 1)您可以拥有Windows服务或控制台应用程序更好是出于以下原因使用Windows服务:-
A Windows Service will run even if a user is not logged into the PC (will run even if the server is sitting at the login prompt) (***Note - this may depend on the version of Windows you are running). 即使用户未登录PC,Windows服务也将运行(即使服务器位于登录提示符下也将运行)(***注意-这可能取决于您所运行的Windows版本)。
A service can run as high-authority accounts such as Network Service or Local System, or a User - they have more configurability in that regard 服务可以作为高权限帐户(例如网络服务或本地系统)或用户运行-在这方面,它们具有更高的可配置性
A service also comes built in with options for starting, stopping, restarting, and pausing while running (sometimes) 服务还内置了一些选项,用于在运行时启动,停止,重新启动和暂停(有时)
You can also set up failure conditions for services, like if it fails have it auto-restart. 您还可以为服务设置失败条件,例如如果服务失败,则将其自动重启。
2)Dataset or DataTable is what you need(After filtering all the data on server) so that all you have to do is insert the record in destination database/databases. 2)数据集或数据表是您所需要的(在过滤服务器上的所有数据之后),因此您要做的就是将记录插入目标数据库/数据库中。
3)As far as filtering condition is concerned you can have it configured as per your convenience, I will prefer executing it once a day(At day end) and insert all records of that day. 3)至于过滤条件,您可以根据自己的方便进行配置,我更喜欢每天执行一次(在日末)并插入当天的所有记录。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.