Trigger runs an external program?

Trigger runs an external program?

Post by James Higg » Sat, 20 Feb 1999 04:00:00



Jason,

You can run an external program with the stored procedure xp_cmdshell and
you could build up a command line to pass to it within the trigger.

Be a little careful with xp_cmdshell - it can be a security hole.  Unless
you set it explicitly to use Use SQLExecutiveCmdExec Account for non SA's
(you can do this in Enterprise manager, but I'm not sure how you do this
programmatically), the user executing xp_cmdshell will have the security
permissions assigned to the server and could, potentially, have
administrator rights on your server.  Have a look at the documentation for
this.

I don't think there are any procedures to write to or read  from a serial
port, but you could create your own extended stored procedure (in VC++)
which you can then call from your triggers, sp's etc.

I have never tried to write and extended sp before, but that's the only way
I can think of to do what you want.

James

 
 
 

Trigger runs an external program?

Post by Gert Draper » Sat, 20 Feb 1999 04:00:00


Not only that, it will be blocking for the duration of the xp_cmdshell,
which I do not think is desirable. So your concurrency will gfo down the
drain. Why don't you queue your commands in some table and have the external
program read from the queue. The solution you propose will flush your
performance down the drain, it will never scale, it is simply a bad design.

-GertD


 
 
 

1. Calling an external program from a Trigger

I have an application (over which I have no control) that inserts
records into a SQL Server 6.5 hosted table.
Some of these records I would like to send of to an external program
as soon as they're inserted.
I was thinking that this might be possible with an INSERT trigger but
I'm not sure if a trigger can invoke an external program.
How would I go about doing this?
Regards,
Matthias

--

---------------------------------------------------------------------

2. FOXPRO 2.6 Win with OS/2 ?

3. calling external program from SQL Trigger.....

4. Using application role

5. How do I call an external program from a trigger

6. Oracle Developer 2000

7. Call an external program from a trigger

8. ANNOUNCE: Database access from HTML pages

9. Trigger for executing an external program

10. Calling external programs from triggers/stored procedure

11. Trigger external program in Oracle

12. triggers, pipes, JDBC or communications with external programs

13. trigger, pipes, JDBC, communication with external program