![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi everyone, I'm trying to call an .NET console exe program from a trigger in Sql Server using the xp_cmdshell procedure. The exe calls a Universe subroutine using UniDK. If I run the exe from cmd it executes properly but when I call it from within Sql Server it says it ran fine and effected one row but the Universe file is not updated. Does any one know another way to do this or what I am doing wrong? thanks |

#3
| |||
| |||
|
|
CJS wrote: Hi everyone, I'm trying to call an .NET console exe program from a trigger in Sql Server using the xp_cmdshell procedure. The exe calls a Universe subroutine using UniDK. If I run the exe from cmd it executes properly but when I call it from within Sql Server it says it ran fine and effected one row but the Universe file is not updated. Does any one know another way to do this or what I am doing wrong? thanks Interesting.... Perhaps when xp_cmdshell executes a command the environment variables are different and that these are having an effect. I can't think what else would be different if it works fine from cmd. I would put plenty of try/catch es in the .net console exe that write to disk, so you can trace better if there is a failure in your code. Otherwise - good luck ![]() Symeon. |
#4
| |||
| |||
|
|
"Symeon" <symeonb (AT) gmail (DOT) com> wrote: CJS wrote: Hi everyone, I'm trying to call an .NET console exe program from a trigger in Sql Server using the xp_cmdshell procedure. The exe calls a Universe subroutine using UniDK. If I run the exe from cmd it executes properly but when I call it from within Sql Server it says it ran fine and effected one row but the Universe file is not updated. Does any one know another way to do this or what I am doing wrong? thanks Interesting.... Perhaps when xp_cmdshell executes a command the environment variables are different and that these are having an effect. I can't think what else would be different if it works fine from cmd. I would put plenty of try/catch es in the .net console exe that write to disk, so you can trace better if there is a failure in your code. Otherwise - good luck ![]() Symeon. This sort of thing is always a research project, but I see the same symptoms occasionally whenever something works fine from the command line but it doesn't work from within some other application executing my command line: MS Word doing an execute, VB shelling out, Windows Services calling other services or trying to execute something simple... Ref: http://www.google.com/search?hl=en&q...ll+permissions The first few hits there have good info on permissions - note various requirements related to the sysadmin role. I'd check the user under which SQL Server is running (Local System, Local Service, Network Service (I believe default)). Then check users for UniRPC, etc. Also, what's triggering SQL Server to execute this code? ASPNET? Finally, under UniDK (and someone with a clue can correct me), if you're using an older version of UO.NET (maybe this hasn't changed, I dunno) then I believe you're actually going through P/Invoke to execute the COM-based UO for connectivity. There might be a permissions issue related to use of COM components across users. I hope this doesn't send you on a wild goose chase. If at first you don't succeed, try/catch try/catch again. HTH |
#5
| |||
| |||
|
|
"Symeon" <symeonb (AT) gmail (DOT) com> wrote: CJS wrote: Hi everyone, I'm trying to call an .NET console exe program from a trigger in Sql Server using the xp_cmdshell procedure. The exe calls a Universe subroutine using UniDK. If I run the exe from cmd it executes properly but when I call it from within Sql Server it says it ran fine and effected one row but the Universe file is not updated. Does any one know another way to do this or what I am doing wrong? thanks Interesting.... Perhaps when xp_cmdshell executes a command the environment variables are different and that these are having an effect. I can't think what else would be different if it works fine from cmd. I would put plenty of try/catch es in the .net console exe that write to disk, so you can trace better if there is a failure in your code. Otherwise - good luck ![]() Symeon. This sort of thing is always a research project, but I see the same symptoms occasionally whenever something works fine from the command line but it doesn't work from within some other application executing my command line: MS Word doing an execute, VB shelling out, Windows Services calling other services or trying to execute something simple... Ref: http://www.google.com/search?hl=en&q...ll+permissions The first few hits there have good info on permissions - note various requirements related to the sysadmin role. I'd check the user under which SQL Server is running (Local System, Local Service, Network Service (I believe default)). Then check users for UniRPC, etc. Also, what's triggering SQL Server to execute this code? ASPNET? Finally, under UniDK (and someone with a clue can correct me), if you're using an older version of UO.NET (maybe this hasn't changed, I dunno) then I believe you're actually going through P/Invoke to execute the COM-based UO for connectivity. There might be a permissions issue related to use of COM components across users. I hope this doesn't send you on a wild goose chase. If at first you don't succeed, try/catch try/catch again. HTH |
#6
| |||
| |||
|
|
"Symeon" <symeonb (AT) gmail (DOT) com> wrote: CJS wrote: Hi everyone, I'm trying to call an .NET console exe program from a trigger in Sql Server using the xp_cmdshell procedure. The exe calls a Universe subroutine using UniDK. If I run the exe from cmd it executes properly but when I call it from within Sql Server it says it ran fine and effected one row but the Universe file is not updated. Does any one know another way to do this or what I am doing wrong? thanks Interesting.... Perhaps when xp_cmdshell executes a command the environment variables are different and that these are having an effect. I can't think what else would be different if it works fine from cmd. I would put plenty of try/catch es in the .net console exe that write to disk, so you can trace better if there is a failure in your code. Otherwise - good luck ![]() Symeon. This sort of thing is always a research project, but I see the same symptoms occasionally whenever something works fine from the command line but it doesn't work from within some other application executing my command line: MS Word doing an execute, VB shelling out, Windows Services calling other services or trying to execute something simple... Ref: http://www.google.com/search?hl=en&q...ll+permissions The first few hits there have good info on permissions - note various requirements related to the sysadmin role. I'd check the user under which SQL Server is running (Local System, Local Service, Network Service (I believe default)). Then check users for UniRPC, etc. Also, what's triggering SQL Server to execute this code? ASPNET? Finally, under UniDK (and someone with a clue can correct me), if you're using an older version of UO.NET (maybe this hasn't changed, I dunno) then I believe you're actually going through P/Invoke to execute the COM-based UO for connectivity. There might be a permissions issue related to use of COM components across users. I hope this doesn't send you on a wild goose chase. If at first you don't succeed, try/catch try/catch again. HTH |
#7
| |||
| |||
|
|
I have replaced the console.writeline with eventlog.writeentry and have nothing written to the eventlog. The sqlagent and sqlmangr processes are running as administrator. The sqlservr is running as System.Sql Server returns a 0 which is suppose to mean succesful. Tony Gravagno wrote: "Symeon" <symeonb (AT) gmail (DOT) com> wrote: CJS wrote: Hi everyone, I'm trying to call an .NET console exe program from a trigger in Sql Server using the xp_cmdshell procedure. The exe calls a Universe subroutine using UniDK. If I run the exe from cmd it executes properly but when I call it from within Sql Server it says it ran fine and effected one row but the Universe file is not updated. Does any one know another way to do this or what I am doing wrong? thanks Interesting.... Perhaps when xp_cmdshell executes a command the environment variables are different and that these are having an effect. I can't think what else would be different if it works fine from cmd. I would put plenty of try/catch es in the .net console exe that write to disk, so you can trace better if there is a failure in your code. Otherwise - good luck ![]() Symeon. This sort of thing is always a research project, but I see the same symptoms occasionally whenever something works fine from the command line but it doesn't work from within some other application executing my command line: MS Word doing an execute, VB shelling out, Windows Services calling other services or trying to execute something simple... Ref: http://www.google.com/search?hl=en&q...ll+permissions The first few hits there have good info on permissions - note various requirements related to the sysadmin role. I'd check the user under which SQL Server is running (Local System, Local Service, Network Service (I believe default)). Then check users for UniRPC, etc. Also, what's triggering SQL Server to execute this code? ASPNET? Finally, under UniDK (and someone with a clue can correct me), if you're using an older version of UO.NET (maybe this hasn't changed, I dunno) then I believe you're actually going through P/Invoke to execute the COM-based UO for connectivity. There might be a permissions issue related to use of COM components across users. I hope this doesn't send you on a wild goose chase. If at first you don't succeed, try/catch try/catch again. HTH |
#8
| |||
| |||
|
|
If console.writeline returned null I don't doubt the eventlog wouldn't have detail either. I was talking about permissions issues which would prevent object instantiation or perhaps attachment of a socket. My reference to try/catch try/catch again wasn't just a joke - put a try/catch around your major blocks, see if you throw an exception, then narrow it down until you know where an error is occuring. The chances are very slim of something not working right but giving you a successful return value. If you are properly writing to eventlog you should see an eventlog with no detail, vs not seeing an eventlog entry at all. If you have no eventlog entry at all then this might be yet another example of the same problem. Try skipping your UO code entirely and just execute a command-line routine that writes to the eventlog. If that doesn't work then you have a completely non-MV issue which needs to be resolved, perhaps with help from a SQLServer forum. HTH T "CJS" <csadlier (AT) vodavi (DOT) com> wrote: I have replaced the console.writeline with eventlog.writeentry and have nothing written to the eventlog. The sqlagent and sqlmangr processes are running as administrator. The sqlservr is running as System.Sql Server returns a 0 which is suppose to mean succesful. Tony Gravagno wrote: "Symeon" <symeonb (AT) gmail (DOT) com> wrote: CJS wrote: Hi everyone, I'm trying to call an .NET console exe program from a trigger in Sql Server using the xp_cmdshell procedure. The exe calls a Universe subroutine using UniDK. If I run the exe from cmd it executes properly but when I call it from within Sql Server it says it ran fine and effected one row but the Universe file is not updated. Does any one know another way to do this or what I am doing wrong? thanks Interesting.... Perhaps when xp_cmdshell executes a command the environment variables are different and that these are having an effect. I can't think what else would be different if it works fine from cmd. I would put plenty of try/catch es in the .net console exe that write to disk, so you can trace better if there is a failure in your code. Otherwise - good luck ![]() Symeon. This sort of thing is always a research project, but I see the same symptoms occasionally whenever something works fine from the command line but it doesn't work from within some other application executing my command line: MS Word doing an execute, VB shelling out, Windows Services calling other services or trying to execute something simple... Ref: http://www.google.com/search?hl=en&q...ll+permissions The first few hits there have good info on permissions - note various requirements related to the sysadmin role. I'd check the user under which SQL Server is running (Local System, Local Service, Network Service (I believe default)). Then check users for UniRPC, etc. Also, what's triggering SQL Server to execute this code? ASPNET? Finally, under UniDK (and someone with a clue can correct me), if you're using an older version of UO.NET (maybe this hasn't changed, I dunno) then I believe you're actually going through P/Invoke to execute the COM-based UO for connectivity. There might be a permissions issue related to use of COM components across users. I hope this doesn't send you on a wild goose chase. If at first you don't succeed, try/catch try/catch again. HTH |
#9
| |||
| |||
|
|
Finally, under UniDK (and someone with a clue can correct me), if you're using an older version of UO.NET (maybe this hasn't changed, I dunno) then I believe you're actually going through P/Invoke to execute the COM-based UO for connectivity. There might be a permissions issue related to use of COM components across users. |
#10
| |||
| |||
|
|
Thanks Tony. I do have the try catch in place. The whole program is only 57 lines including comments and blank lines. I'll try just writing to the eventlog. It did create the log but no entries. How would I check the permissions for instantiation of the object? |
![]() |
| Thread Tools | |
| Display Modes | |
| |