dbTalk Databases Forums  

SQL Server calling a Universe Subroutine

comp.databases.pick comp.databases.pick


Discuss SQL Server calling a Universe Subroutine in the comp.databases.pick forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
CJS
 
Posts: n/a

Default SQL Server calling a Universe Subroutine - 09-20-2006 , 10:15 AM






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


Reply With Quote
  #2  
Old   
Symeon
 
Posts: n/a

Default Re: SQL Server calling a Universe Subroutine - 09-20-2006 , 11:23 AM







CJS wrote:
Quote:
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.



Reply With Quote
  #3  
Old   
Tony Gravagno
 
Posts: n/a

Default Re: SQL Server calling a Universe Subroutine - 09-20-2006 , 12:30 PM



"Symeon" <symeonb (AT) gmail (DOT) com> wrote:
Quote:
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


Reply With Quote
  #4  
Old   
CJS
 
Posts: n/a

Default Re: SQL Server calling a Universe Subroutine - 09-20-2006 , 02:42 PM



I'm just trying to run from Sql Analyzer now but eventually it will be
called from a trigger. I'll write to a file instead of the console and
see if an error is being thrown that Sql Server is hiding and I check
the permission. Thanks
Tony Gravagno wrote:
Quote:
"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


Reply With Quote
  #5  
Old   
CJS
 
Posts: n/a

Default Re: SQL Server calling a Universe Subroutine - 09-20-2006 , 02:42 PM



I'm just trying to run from Sql Analyzer now but eventually it will be
called from a trigger. I'll write to a file instead of the console and
see if an error is being thrown that Sql Server is hiding and I check
the permission. Thanks
Tony Gravagno wrote:
Quote:
"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


Reply With Quote
  #6  
Old   
CJS
 
Posts: n/a

Default Re: SQL Server calling a Universe Subroutine - 09-20-2006 , 04:32 PM



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:
Quote:
"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


Reply With Quote
  #7  
Old   
Tony Gravagno
 
Posts: n/a

Default Re: SQL Server calling a Universe Subroutine - 09-20-2006 , 08:17 PM



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:

Quote:
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


Reply With Quote
  #8  
Old   
CJS
 
Posts: n/a

Default Re: SQL Server calling a Universe Subroutine - 09-21-2006 , 09:22 AM



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?
Tony Gravagno wrote:
Quote:
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


Reply With Quote
  #9  
Old   
Symeon
 
Posts: n/a

Default Re: SQL Server calling a Universe Subroutine - 09-21-2006 , 09:58 AM




Tony Gravagno wrote:

Quote:
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.


FYI i think on the very first version of UO.NET this may have been the
case. The current versions are definatley managed code, so there should
not be any COM issues.

Sym.



Reply With Quote
  #10  
Old   
Tony Gravagno
 
Posts: n/a

Default Re: SQL Server calling a Universe Subroutine - 09-22-2006 , 04:01 AM



"CJS" wrote:
Quote:
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?
I'm sorry, but this is way too deep, and now obviously not even
related to this forum (Pick=Universe). Please contact your vendor or
another support provider who specializes in SQL Server. One of my
colleagues may be able to help on a consulting basis. I hope I've
provided some decent leads so far but I can't provide this level of
diagnostics in a free forum.

Good luck.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.