Tuesday, March 27, 2012

Downloads becoming corrupt while use FTP Task

I have a Package that downloads apprx 15 data archives from an FTP site using FTP Tasks.

My problem is that the data contained within these archives (.Z) are becoming corrupt after download/extracting. I have isolated the problem to the FTP File Task by manually downloading the archives myself from IE's built-in FTP client and disabling the downloads in the Control Flow. The Control Flow will then execute the extracting script and continue without any problems.

If I run the Package with the FTP Tasks enabled it will get to a random spot in the validation (I haven't been able to see any consistency with where it errors) of the flat files and error with either a truncation error or a (don't remember exactly what it was) error that talks about an unexpected end in the file. I believe this is because the data has become corrupt and has started skipping/excluding columns. I have opened the flat file and examined it, and sure enough, the data at the end seems to just end.

I have tried setting the FTP Connection to Use Passive Mode in the config file - doesn't work.

So, my question is: Has anyone encountered similar problems? If so, what did you do to fix the problem? I'd really like to use the FTP Task rather than reinventing it with a custom script.Are you downloading these files sequentially to the same local file? If yes, add File System Task that deletes the destination (local) file before downloading to it.

There is a known issue with FTP task - it does not delete the destination file before overwriting it with content of new file. So if one of the files is smaller than than previous one - the file will have garbage from older file in the end. This problem will be corrected by SP2, and the workaround is to delete the local file or use unique local names.sql

No comments:

Post a Comment