简体   繁体   English

每天将数据从远程服务器数据库传输到本地数据库

[英]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: 我现在有一些具体的问题:

  • What type of data should the web service return ? Web服务应返回什么类型的数据?
  • How to ask only the data from the web service that is not already found in the local database ? 如何仅询问来自Web服务的本地数据库中尚未找到的数据?

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.

相关问题 当远程数据库中不存在数据时,如何从本地数据库中选择数据 - How to select data from local database when it is not present in remote database 将数据从Excel工作表传输到SQL Server数据库 - Transfer data from Excel sheet into SQL Server database 数据从一个数据库传输到另一个数据库 - Data transfer from One database to another 使用DataTable从远程SQL Server获取记录并将其保存到本地SQL数据库的最快方法 - Fastest way to fetch records from remote sql server and save to local sql database using DataTable 使用年度数据设计数据库,每天更新 - Designing a database with yearly data, updated daily 从 Heroku 容器化应用程序连接到远程 SQL Server 数据库 - Connecting to a remote SQL Server database from Heroku containerized app 使用数据源确定本地SQL Server CE数据库的路径 - Determining the path to the the local SQL Server CE database using Data Source 将服务器数据库备份到本地机器 - Backup of server database to local machine .NET快速入门项目和本地主机上的本地数据库/ MDF,但在远程服务器上却出现异常? - .NET Quick Start project and local database/MDF working on localhost but giving exceptions on remote server? 在Windos Phone 7.1中从服务器更新本地数据库 - Update local database from server in windos phone 7.1
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM