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 2008 Forums
 SSIS and Import/Export (2008)
 FTP Task Receives Empty File

Author  Topic 

Ken Blum
Constraint Violating Yak Guru

383 Posts

Posted - 2009-10-05 : 12:02:33
I have created an FTP Task that is supposed to download a text file from an FTP site. It connects and downloads the file, but the file always contains zero bytes. When I look at the files within Windows Explorer, they all show zero bytes, but when I Copy/Paste a file it contains the data. The people who maintain this FTP site say this is a "standard FTP site" and that the files are not publicly show on the FTP site, but are some sort of "pointer" to the file.

So I wrote a VB Script within SSIS to download the file, and that works! Has anybody seen this issue with an FTP Task? Am I missing some setting?

Here's the script code that works, sans login information...


Dim cm As ConnectionManager = Dts.Connections.Add("FTP")

'Set the properties like username & password

cm.Properties("ServerName").SetValue(cm, "MyIPAddress")

cm.Properties("ServerUserName").SetValue(cm, "MyUser")

cm.Properties("ServerPassword").SetValue(cm, "MyPW")

cm.Properties("ServerPort").SetValue(cm, "21")

cm.Properties("Timeout").SetValue(cm, "0") 'The 0 setting will make it not timeout

cm.Properties("ChunkSize").SetValue(cm, "1000") '1000 kb

cm.Properties("Retries").SetValue(cm, "1")

'create the FTP object that sends the files and pass it the connection created above.

Dim ftp As FtpClientConnection = New FtpClientConnection(cm.AcquireConnection(Nothing))

'Connects to the ftp server

ftp.Connect()

'Build a array of all the file names that is going to be FTP'ed (in this case only one file)

Dim files(0) As String

files(0) = "/irc_SHOP_AVERAGE_AMBIENT.txt"

'ftp the file

ftp.ReceiveFiles(files, "C:\Temp\FTP", True, False) '
ftp.Close()

TIA,

Ken
   

- Advertisement -