Creating socket inside a SQL-CLR trigger or stored procedure

家住魔仙堡 提交于 2019-12-11 01:35:20

问题


I have a SQL-CLR trigger in SQL Server 2008 that sends out message to socket server. It works fine but I need the TCP client to stay connected to the server it communicates with.

In order to do this I have to make some thread that stays alive. So I created a thread added the message to queue, I see client connecting but SQL Server kicks out before the client is able to process the queued message and send it to tcp server.

The purpose of this application is to send what fields and some values associated to them that were updated via xml. I wanted to put them in queue that gets handled in thread and send to TCP Socket Server.

What I am planning as alternative now is have CLR Trigger add messages to MSMQ and have another service to process these messages.

Any good suggestions how to accomplish this?


回答1:


CREATE ASSEMBLY Messaging AUTHORIZATION dbo FROM 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Messaging.dll' WITH PERMISSION_SET = UNSAFE GO



来源:https://stackoverflow.com/questions/10236288/creating-socket-inside-a-sql-clr-trigger-or-stored-procedure

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!