Hi,
I already asked this question before but did not get any reply. Anybody please help..
I am calling a job on AS400 which uses RUNRMTCMD to execute a batch file on sqlserver 2005 server. This batch file uses sqlcmd command to run a job on sqlserver. When I execute this batch file manually from this sql server computer it works fine. But when I am trying to run it thru the AS400 job it doesn't work. When I created a test batch file which runs thru the AS400 job but doesn't use the sqlcmd command and tried to run that batch file from the sql server computer thru calling the AS400 job that works fine.The remote login used in the AS400 program has all the administrative rights and I tried tp logon as this login and try to execute that batch file locally , it works fine. Please help. Thanks in advance.
Software/Hardware used:
ASKED:
October 23, 2006 10:43 AM
UPDATED:
December 24, 2009 11:47 PM
Thanks for your reply TonyRa. Here are the informations:
The As400 CL program is like this:
PGM
RUNRMTCMD CMD(‘C:BATCHESWWW03W.BAT’)
RMTLOCNAME(‘IP_address of the sql 2005 computer’ *IP) +
RMTUSER(‘userName’) RMTPWD(‘Password’)
ENDPGM
The batch file is like this:
sqlcmd -S Ip_address -d msdb -U user_name -P password -i “c:batchesWWW03W_input.txt” -o “c:batchesWWW03W_output.txt”
The input file is like this:
sp_start_job @job_name = “Impt_WWW03W_ODBC”
Inside the batch file if I write some non-sql commands like copy file . It works.
Thank you !
Might be a minor point… but when I key some values into the RUNRMTCMD command in the source file editor on the iSeries the RMTUSER field and the PWD field do not have single quotes around the entries.
Thanks for your reply DeadMeatinLA. But this CL program works fine with our SQL 7 server. Just does n’t work for SQL 2005. Also if I include some non-sql command in the batch file like copy file and call this program it works. It does n’t execute the sql command to run this job.
Thank you..
When you logon to the SQL 2005 system (actually on the system, not through any remote database connection), is the user defined on that PC and do you logon to the PC? Or is the user logging on to the network? I.e., is that user only defined as a local user?
If a user of the same name is defined on the PC and on your network, be sure they’re not being confused when you sit down at the PC to test the logon.
Then, is that user (the local PC user) authorized in the SQL 2005 database?
Tom