April 10, 2003 at 10:42 am
I seem to be having problems with running the following line of code:
EXEC master..xp_cmdshell 'ftp -s:"c:\ftpSend.txt"'
Normally this is how I would right it if I were to run this manually in a command line:
ftp -s:"c:\ftpSend.txt"
This file has some FTP information in it so that I can ftp documents to another server. It runs through the file however it doesn't actually upload the file. Here is what ftpSend.txt look like.
open 111.11.111.111
username
password
cd images
cd pdf
put C:\images\PDF\08042003_Alerts.pdf
quit
Can anyone help??
April 10, 2003 at 10:55 am
We do this all the time at this company. The only diff I can see between what you're doing and what we do is:
ftp -s:D:\filepath\scriptfilename.txt http://ftp.site.com
No quotes around the script file name.
<Shrug>
SJTerrill
April 10, 2003 at 10:57 am
Can you successfully type the commands manually?
April 10, 2003 at 11:08 am
There is one difference between running commands directly using command window and running xp_cmdshell.
When you are running xp_cmdshell Sql*Server executes the command under the context of SQLAgentCmdExec.
One way to trace the problem would be to login to the server PC with this account SQLAgentCmdExec and try to run the same command in command window and see whether it works.
Hope this helps.
April 10, 2003 at 11:15 am
That doesn't help. Because for FTPing, it would use the userid and password mentioned
exec xp_cmdshell 'ftp -s:D:\Utilities\FTP.TXT'
We use this daily. If this is not putting the file on the Server, then WRITE access might be denied for this userid mentioned in the script. Please check the access rights for this userd id.
Hope this Help!!!
Regards,
Murali Damera.
.
April 10, 2003 at 11:16 am
After checking the access rights for userid mentioned in the ftp script(c:\ftpSend.txt), try running this manually thru Query Analyser.
.
April 10, 2003 at 12:15 pm
OK I have tried a number things including running the following line of code in analyzer:
EXEC master..xp_cmdshell 'ftp -s:c:\ftpSend.txt'
here are the results:
User (209.63.127.202:(none)):
NULL
NULL
cd images
cd pdf
put Q:\Shared\GRIPA\WebDevelopment\GRIPAWEB\images\PDF\08042003_Alerts.pdf
quit
Not sure why Im getting the NULL's in there. I checked to see if the file got uploaded and it did not. I definately have users rights.
I have also tried running just ftp -s:c:\ftpSend.txt in the command prompt and this works fine as well without the quotes but not in analyzer it returns:
User (209.63.127.202:(none)): open 209.63.127.202
NULL
NULL
NULL
cd images
cd pdf
put Q:\Shared\GRIPA\WebDevelopment\GRIPAWEB\images\PDF\08042003_Alerts.pdf
quit
Can’t beleive I can't get this to work it seems pretty straight forward
April 10, 2003 at 12:22 pm
is your userid and the id mentioned in the inFTP.txt the same?!
You can try this:
1. goto command prompt.
2. manually type ftp 209.63.127.202
3. give userid
4. give password
type the following one after the other:
5. cd images
6. cd pdf
7. put Q:\Shared\GRIPA\WebDevelopment\GRIPAWEB\images\PDF\08042003_Alerts.pdf
8. quit
See what you get. You might be getting the exact error this way.
I used to verify the same way, if I need to check the permissions on the minframe for FTP IDs.
Let us know the results.
Regards,
Murali Damera.
.
April 10, 2003 at 12:35 pm
I have tried that before and it worked. I just tried it again and it stills works..
April 10, 2003 at 12:43 pm
This is how we have the script (as FTPSEND.TXT for one of our jobs:
quote:
open MF01userid
password
delete 'mainframe.data.set'
quote SITE LRECL=90 BLKSIZE=0 RECFM=FB TRACKS PRI=200 SEC=150
put D:\utilities\mainframefeed.dat 'mainframe.data.set'
close
bye
the way we have scheduled in the SQL Server is :
quote:
exec xp_cmdshell 'ftp -s:D:\Utilities\FTP.TXT'
Which Operating system you are sending this to? Try deleting first and then use "put". Might work. I donno.
Regards,
Murali Damera.
.
April 10, 2003 at 12:53 pm
We are sending it to a 2000 server box from a 2000 server box
I tried it several more time but still no results.
April 10, 2003 at 9:08 pm
Can use use a copy command to a UNC or a mapped drive instead?
-DMS
April 14, 2003 at 2:51 pm
Edited by - im4718 on 04/14/2003 3:03:37 PM
Viewing 13 posts - 1 through 12 (of 12 total)
You must be logged in to reply to this topic. Login to reply