Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Encounter Error when FTP get file using tsql

Author  Topic 

winz
Starting Member

5 Posts

Posted - 2006-08-07 : 23:25:33
Hi,

I have tried to create my procedure by cut and paste the sample FTP get file using tsql from Author Nigel Rivett (http://www.nigelrivett.net/FTP/s_ftp_GetFile.html).

When I tried to execute it by passing parameter as below:

exec s_ftp_GetFile
@FTPServer = 'www.mysite.com' ,
@FTPUser = 'mysite' ,
@FTPPWD = 'xxxxxxx' ,
@FTPPath = '' ,
@FTPFileName = 'chat.asp' ,
@SourcePath = 'D:\wwwusr\mysite\web\' ,
@SourceFile = 'chat.asp' ,
@workdir = 'c:\Temp\'

I encounter error ouput as below

1 User (mysite.com:(none)): open www.mysite.com
2 Error opening local file D:\wwwusr\mysite\web\chat.asp.
3 NULL
4 NULL
5 NULL
6 get chat.asp D:\wwwusr\mysite\web\chat.asp
7 quit
8 > D:\wwwusr\mysite\web\chat.asp:Permission denied
9 NULL

Please advise....



nr
SQLTeam MVY

12543 Posts

Posted - 2006-08-08 : 04:24:29
Sounds like you (probably the sql server service) doesn't have permission on the local folder.
If you look at the command file created you can run the commands in ftp manually to see what's happening.

try master..xp_cmdshell 'echo hello > D:\wwwusr\mysite\web\test.txt'
and see if that creates a file.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

winz
Starting Member

5 Posts

Posted - 2006-08-12 : 02:13:50
Hi, Thank you for your reply, for your information that actually we our web site is hosted at Web Hosting Company, so I can't try the command...what should I do? should I contact our web hosting company???? why we can use FTP software to do file transfer but fail when using this script??

pls advise....
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2006-08-12 : 07:36:43
Is it a shared hosting site? If so I would expect that you can't use xp_cmdshell or FTP.
I would be a bit surprised if you can use ftp at all as you wouldn't have access to the local disk.
You probably need to ask the hosting company what is available.

If you have your own hosted server then it should be allowed but you might have to discuss it with them.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

winz
Starting Member

5 Posts

Posted - 2006-08-21 : 22:34:15
Hi, Thank for all the reply..my problem solved, is due to wrong parameter passing.

exec s_ftp_GetFile
@FTPServer = 'www.mysite.com' ,
@FTPUser = 'mysite' ,
@FTPPWD = 'xxxxxxx' ,
@FTPPath = '' , ---Should specify the file directoty at Remote Server
@FTPFileName = 'chat.asp' ,
@SourcePath = 'C:\myftpfile\', -- The source path should be the path the file will be stored in our local machine
@SourceFile = 'chat.asp' ,
@workdir = 'c:\Temp\'

Thank you.
Go to Top of Page
   

- Advertisement -