Sql代理还是Windows服务?何时需要? [英] Sql agent or windows service? When is which needed?

查看:72
本文介绍了Sql代理还是Windows服务?何时需要?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个数据库db1,它有自己用c#开发的应用程序。还有其他几个应用程序,每个应用程序都有自己的数据库。这些其他应用程序将数据存储在自己的数据库中,并使用db1中创建的存储过程在db1中记录一些文档。 db1应用程序的用户需要接受其他应用程序/数据库存储的文档;当他接受它时,会自动在db1中存储文档的应用程序的数据库中执行一些CRUD操作。 Db1不需要知道其他应用程序,反之亦然,因为在将来开发新应用程序时修改db1是不合适的。我的问题是如何自动执行这些CRUD操作?:我在考虑1.在mssql中创建一个工作来执行该操作;开发新应用程序时,会创建一个作业来获取其文档的状态,然后在其数据库中执行操作。

2.为每个应用程序创建Windows服务应用程序,定期检查它存储在db1中的文档的状态,然后执行CRUD操作 - 该服务将在服务器上运行。

3.创建单个Windows服务,获取所有文档的状态,执行CRUD对数据库列表的操作。开发新应用程序时,会将其数据库添加到列表中。



欢迎任何其他建议。



我尝试过:



我不知道选择哪个选项:哪个最好

I have a database db1 which has its own application developed with c#. There are several other applications, which each has its own database. These other applications store data in their own databases and record some documents in db1 using a stored procedure created in db1. The user of the db1 application needs to accept the document stored by the other application/database; when he accepts it, automatically some CRUD actions are performed in the database of the application that stored the document in db1. Db1 needs not to be aware of the other applications but the other way round because it is improper to modify db1 when new applications are developed in future. My question is how do I perform these CRUD actions automatically?: I was thinking of 1. Creating a job in mssql to perform that; when new applications are developed, a job is created for it to fetch the status of its document then perform the action in its database.
2. Creating windows service application for each of the applications, which periodically checks the status of the document it stored in db1, then perform the CRUD actions- this service will run on the server.
3. Creating a single windows service, which fetches the status of all documents, the perform CRUD actions on list of databases. When new applications are developed, their database is added to the list.

Any other suggestions are welcomed.

What I have tried:

I don’t know which option to choose: which is best

推荐答案

我正在考虑这种方法



1)你必须在DB1的某些表格中提交文件

2)添加额外的字段来存储数据库服务器的详细信息文档来自哪里(其他应用程序)

3)在DB1服务器中写入任务以在DB1中添加远程服务器

在此处阅读有关远程服务器以及我们需要它的原因

查看或配置远程服务器连接选项(SQL Server)| Microsoft Docs [ ^ ]



4)在DB1文档表中添加触发器以查找新的接受文档然后使用远程服务器连接在其他数据库上运行CRUD操作
I am thinking on this approach

1) You must be submitting the documents in some table on DB1
2) Add extra fields to store the DB server details where the document is coming from (other applications)
3) Write task in DB1 server to add remote server in DB1
Read here about remote server and why we need it
View or Configure Remote Server Connection Options (SQL Server) | Microsoft Docs[^]

4) Add trigger in DB1 document table to look for newly accepted document and then accordingly run the CRUD operations on other database using the remote server connection


这篇关于Sql代理还是Windows服务?何时需要?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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