sql - How To Forward Data To An External System If There Were Changes During An INSERT or UPDATE? Use a Trigger? Use Extended Sproc or CLR Integration? -
The basics of this system are today we have a table of SQL 2005/2008:
Make Table [DBO]. [Primary] [Primary]
Data field [[firm] [Character] [4] Faucet, [Account] [Characters] (10) [Woman] [Original]] [Original] [Primary] There is a blob, this is the place where virtually all the stuff are bob data compressed text which looks like an INI file, in which the key-value is added within the squares. The internal layout of the INI file is very complex, but too much difference With data related to.
We also have another product family which is designed, action Navan and target are very different in the audience. But now we have a customer who wants to integrate two systems at the database level.
My system is MSSQL and other systems are both MySQL A custom middleware solution of my design sits I do not want to connect directly to MySQL, and they do not want to connect directly to me, for various reasons which are sound and the scope of this conversation So, do not worry about that.
The concept is simple when my profile touches a line in the table, I need to rip through the blob and see some bits data. If those pieces have changed, then I do not need to send the bits of the data (whole blob) for the middleware piece. I should do only when there is a change in which I am interested, and only Rica I can do that is to act on both Blobs (original and replacement).
I have quickly concluded that there is no block road to process T-SLUL, which I want to go down. I need to write a custom code, and I am forced to use unmanaged C ++, Managed C ++ or C # to do this.
Here are some questions.
FIRST : Should I use INSTEAD to trigger, OK, trigger the code that will compare BLOB and send interesting data? I know there are some extreme schools to think about Triggers: Some people think that they are pure Evil, others feel that they are horrible, the truth is somewhere in the middle. If I do not use the trigger, then how can I trigger Blob to process it?
SECOND : Should I use it:
- The process written in an expanded stored unmanaged C ++?
- A CLR stored procedure that is written in managed C ++ or C #?
- Something else?
... to send data to the actual processing of Blob and the middleware? Do not connect to
An external process in a trigger, you will make yourself a mess.
Add a trigger to the table, which enqueues messages for a local service on insert / update. Attach a process to the service queue. After INSERT / UPDATE, the encrypted message will activate the process, you can deploy the message and connect to your middleware logic (like through CLR) in this way you can cancel the update / insert transaction from the notification Do it. It is beneficial for both the performance (now has to wait to connect to the middleware during the trigger) and accuracy (INSERT / UPDATE) to properly rollback w / o to enroll middleware and / or MySQL in your distributed transaction ).
You can either log in to trigger your "interesting data" in the trigger or in the active process. If there is T-SQL, then I will put it in the trigger. If you keep it in the CLR process, then I will put it in active part.
To be able to connect externally to your active process, you will need to sign the part that your middleware See here
Comments
Post a Comment