First using the magic of an extended stored procedure, we can call our console application from an MS SQL trigger. We create our table in Enterprise Manager and then use the trigger to call our console application. You could also call a COM object for that purpose.

1. Using SQL trigger

On the SQL side, we’ve set-up a trigger within our table of e-mail addresses. Upon updating a record, it will get the ID of the changed record and then call the console application by using xp_cmdshell. The xp_cmdshell is an extended stored procedure.

This is a special DLL written in Microsoft Visual C++ .NET. It is comes standard with MSSQL Server. In SP3 for MSSQL Server you need to give the user calling this stored procedure rights to call console applications.

15 Seconds : Queue MSMQ Messages from SQL Server

15 Seconds : Leveraging MSMQ in ASP.NET Applications

2. Accessing COM Objects from Java

In this section we describe how you can create an instance of a COM object, and use it from Java using J-Integra. We also explain how to deal with new references to COM objects that are returned from method calls to COM objects:

J-Integra for COM