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 2005 Forums
 SSIS and Import/Export (2005)
 FTP Script Task receivefiles no data in local file

Author  Topic 

kublai
Starting Member

1 Post

Posted - 2009-02-05 : 17:31:41
Hi All,

I'm doing the standard script of receiving files but when I do it it pulls the right files but it contains no data. Any ideas? I've played around with the timeouts and ASCII transfer and it doesnt work. Has anyone encountered this before? Its doing everything corretly, but the files in the local directory doesnt contain any data and the same file on FTP contains data.. the FTP is on UNIX

Dim cm As ConnectionManager = Dts.Connections.Add(Dts.Variables("User::protocol").Value.ToString)
'Set the properties like username & password
cm.Properties("ServerName").SetValue(cm, Dts.Variables("User::ftpServer").Value.ToString)
cm.Properties("ServerUserName").SetValue(cm, Dts.Variables("User::ftpUserName").Value.ToString)
cm.Properties("ServerPassword").SetValue(cm, Dts.Variables("User::ftpPassword").Value.ToString)

If Dts.Variables("User::protocol").Value.ToString = "FTP" Then
cm.Properties("ServerPort").SetValue(cm, "21")
End If

cm.Properties("Timeout").SetValue(cm, "60") '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()
ftp.SetWorkingDirectory(Dts.Variables("User::ftpPath").Value.ToString)
'Build a array of all the file names that is going to be FTP'ed (in this case only one file)
Dim fileName(0) As String
Dim folderNames() As String

fileName(0) = Dts.Variables("User::fileName").Value.ToString

ftp.ReceiveFiles(fileName, Dts.Variables("User::localFileDirectory").Value.ToString, True, True)
ftp.Close()

rgombina
Constraint Violating Yak Guru

319 Posts

Posted - 2009-02-06 : 06:31:44
Check this article and see if it helps -
http://social.msdn.microsoft.com/Forums/en-US/sqlintegrationservices/thread/2b7cf6b5-d16d-44cd-954d-68e9ba98ee91/
Go to Top of Page
   

- Advertisement -