Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

FTP files using SSIS script task.

Posted on 2007-11-20
3
13,641 Views
Last Modified: 2013-11-07
I have a requirement in SSIS to connect to a remote ftp site, download all files to a local drive and then remove only the remote files that I've transferred. The file names will be different each time.

I've got the attached code in a script task in my SSIS package:

Which always gives me the following error:

Exception from HRESULT: 0xC0016031
  at Microsoft.SqlServer.Dts.Runtime.Wrapper.IDTSFtpClientConnection90.ReceiveFiles(String[] remoteFileNames, String localPath, Boolean overWrite, Boolean transferASCII)
   at Microsoft.SqlServer.Dts.Runtime.FtpClientConnection.ReceiveFiles(String[] remoteFileNames, String localPath, Boolean overwrite, Boolean isTransferAscii)
   at ScriptTask_613a13b6b4eb4c41bb9ab2fb7e238a98.ScriptMain.Main()


Files exist and the connection appears to be made...

Am I missing something obvious here?

JC


Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Runtime
 
Public Class ScriptMain
 
    Public Sub Main()
 
        '  Try
 
 
        Dim cm As ConnectionManager = Dts.Connections.Add("FTP")
 
        cm.Properties("ServerName").SetValue(cm, "******")
 
        cm.Properties("ServerUserName").SetValue(cm, "*******")
 
        cm.Properties("ServerPassword").SetValue(cm, "******")
 
        cm.Properties("ServerPort").SetValue(cm, "21")
 
        cm.Properties("Timeout").SetValue(cm, "0")
 
        cm.Properties("ChunkSize").SetValue(cm, "1000") '1000 kb
 
        cm.Properties("Retries").SetValue(cm, "1")
 
        Dim ftp As FtpClientConnection = New FtpClientConnection(cm.AcquireConnection(Nothing))
 
        ftp.Connect()
 
        Dim fileNames() As String
        Dim folderNames() As String
 
        ftp.GetListing(folderNames, fileNames)
        
 
        ftp.ReceiveFiles(fileNames, "o:\pods\", True, True)
 
        'ftp.DeleteFiles(fileNames)
 
        ftp.Close()
 
 
        'Catch ex As Exception
 
        '    Dts.TaskResult = Dts.Results.Failure
 
        'End Try
 
        'Dts.TaskResult = Dts.Results.Success
 
    End Sub
 
End Class

Open in new window

0
Comment
Question by:misdevelopment
  • 2
3 Comments
 

Author Comment

by:misdevelopment
ID: 20320241
As a further note, I've just noticed this:

Error: 0xC0016031 at Package, Connection manager "{867A9FF2-E663-4F72-BA5D-6BAFC76FE273}": No files to transfer. This error can occur when performing a Send or Receive operation and no files are specified for the transfer.

Which is suggesting that no files are being picked up from getlistings.... or that I'm not passing them to the string array properly? Hmmmmm anyone?
0
 

Author Comment

by:misdevelopment
ID: 20320356
I feel silly.

I didn't set the working directory to "/outgoing"

Nothing to see here :-)

Thanks,

JC
0
 

Accepted Solution

by:
EE_AutoDeleter earned 0 total points
ID: 20968430
Melvinivitch,
Because you have presented a solution to your own problem which may be helpful to future searches, this question is now PAQed and your points have been refunded.

EE_AutoDeleter
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Unable to open debugger port in Intellij idea 6 335
SQL Merige returns error code when updating 15 54
Selection from table2 where criteria for table1 10 49
Help Required 2 39
Introduction This article will provide a solution for an error that might occur installing a new SQL 2005 64-bit cluster. This article will assume that you are fully prepared to complete the installation and describes the error as it occurred durin…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question