Link to home
Start Free TrialLog in
Avatar of vpalmu
vpalmu

asked on

Prolems when calling an .exe file from SQL server job...

I have created a job that has one step that calls small program with "CmdExec" command (Operating System Command). This job is currently installed on 20 different computers. The job doesn't run correctly on one of these computers.

It seems that the SQL server has some problems when using CmdExec command.
When I run the job on that computer I'll receive an following error message:
"Application error !  The application failed to initialize properly (0xc0000142), Click on Ok to terminate the application".

When I run my program from command prompt I works OK. The programs doesn't have
interface and normally it takes som 5-10 minutes to terminate the execution.

Computer configuration: Windows 2000 Pro SP2 + SQL2000

What could be a problem ? Everything was running smoothly until last week when this problem first came up.
Avatar of ispaleny
ispaleny
Flag of Czechia image

Several questions, all about the problematic server.
-----------------------------------------------------------
1. Can you run it from command line (CMD.EXE) ?
2. Can you run it from SQL server ?
 exec master.dbo.xp_cmdshell 'commandline'
3. Startup account of SQL Server ?
4. Startup account of SQL Server Agent ?
Avatar of amaronjob
amaronjob

Try by changing the path:

"C:\Documents and Settings\Administrator\Desktop\New Folder\file.exe"
or
"C:\DOCUME~1\ADMINI~1\DESKTOP\NEWFOL~1\FILE.EXE"

vpalmu,

It can be a problem of file permissions, COM permissions,  filesystem SQL Server Agent or any other.

But you must reply first !!!!

You can try installing of W2K SP3 and SQL2K SP3.
This can prevent most issues.

(Windows 2000 Pro -> MSDE)?

Avatar of vpalmu

ASKER

amanronjob,

I'm not using long directosy names. The directory is currently "c:\sstp". I have already tried to use the root directory "c:\" and the problem continues.
Avatar of vpalmu

ASKER

ispaleny,

I have thought about that, the file and directory permissions are already chekced.
SQL-Server agent + MSSQLServer are running under "sysadm" accont. I have already created another job that call my app, but that didn't help.
Avatar of vpalmu

ASKER

ispaleny,
Some answers:

1. Can you run it from command line (CMD.EXE) ?

- It runs ok. from command line, that's why I'm thinking  that SQL-Server might have some problems.

2. Can you run it from SQL server ?
exec master.dbo.xp_cmdshell 'commandline'

- I will try this.

3. Startup account of SQL Server ?
- Local system account (sorry about the previous "sysadm"  answer, my mistake).

4. Startup account of SQL Server Agent

- Local system account.
Setup SQL Server Agent to login as administrator, restart SQL Server Agent and try again.
Avatar of vpalmu

ASKER

ispaleny,

My app runs normally with command:
"exec master.dbo.xp_cmdshell 'commandline'"

does this mean something ?? Is this different from
starting my prog form job ??

>>Is this different from starting my prog form job ??<<
Sure, one is on a workstation the other is on the server.

Anthony
Avatar of vpalmu

ASKER

acperkins,

My app is installed on the same computer than the
SQL-Server. What I ment was, is there a differece when I run my app with the "exec" command from Query Analyzer or  when I call my app from SQL-Server job using the "CmdExec" command ??
The executor of your job is SQL Server Agent startup account.
The executor of xp_cmdshell is SQL Server.

But you posted both are SYSTEM.
ASKER CERTIFIED SOLUTION
Avatar of ispaleny
ispaleny
Flag of Czechia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Killed in action ?
Avatar of vpalmu

ASKER

Sorry for the late reply...the option 4 works. Now, I couldn't find out why CmdExec won´t work on that machine, but that's ok.
vpalmu,
Some solution is better than none. Post later if you find ( or want to find ) why it didn't work.
Best regards, Ivo Spaleny.