Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FTP Connection string using expression in SSIS

In my SSIS 2005 package, I need to give the FTP Connectionstring via an expression as I need to keep it configurable for the user from the dtsConfig file.

At the moment I tried giving the following expression:

Connectionstring = @[User::FTPServer] + "." + @[User::FTPUser] + "." + @[User::FTPPass]

For this unique syntax, I took pointers from the discussion at http://social.msdn.microsoft.com/Forums/en-US/sqlintegrationservices/thread/3713e9a5-343a-4c5b-ac5d-1508cd5ab8be

My FTPServer variable also has port info in the format MYSERVERNAME:21.

But I am getting the error "530 User anonymous unknown"

Any idea how I can fix this error?

like image 961
Saurabh Kumar Avatar asked Oct 08 '10 06:10

Saurabh Kumar


People also ask

How do I pass a connection string in SSIS?

Parameterising the connection stringCopy the text in the ConnectionString property. Click on the build symbol to the right of the Expressions property. Choose the ConnectionString property from the list, and click on the build button to set the expression for this. Paste your connection string into the box.

How do I find the connection string in SSIS?

For example, a connection manager includes the ConnectionString property that you set at design time; at run time, a physical connection is created using the value in the connection string property. A package can use multiple instances of a connection manager type, and you can set the properties on each instance.

Which task is used to load a file to another server?

You can use the FTP task for the following purposes: Copying directories and data files from one directory to another, before or after moving data, and applying transformations to the data. Logging in to a source FTP location and copying files or packages to a destination directory.


1 Answers

I think your variables should have two :: not one.

@[User::FTPServer] + "." + @[User::FTPUser] + "." + @[User::FTPPass]

EDIT:

You may be having some trouble due to the password being cleared

What I would do is set these details beforehand via a Script Task. Run the script and then run the FTP Task - I think that should that work.

Public Class ScriptMain

Public Sub Main()

Dim FTPConnectionManager As ConnectionManager

'Set variable to an existing connection manager
' Replace "FTP Server" with the name of your existing FTP Connection Manager
FTPConnectionManager = Dts.Connections("FTP Server")


FTPConnectionManager.Properties("ServerName").SetValue(FTPConnectionManager, Dts.Variables("FTPServer").Value)

FTPConnectionManager.Properties("ServerPort").SetValue(FTPConnectionManager, Dts.Variables("FTPPort").Value)

FTPConnectionManager.Properties("ServerUserName").SetValue(FTPConnectionManager, Dts.Variables("FTPUserName").Value)

FTPConnectionManager.Properties("ServerPassword").SetValue(FTPConnectionManager, Dts.Variables("FTPPassword").Value)


Dts.TaskResult = Dts.Results.Success

End Sub

End Class
like image 96
codingbadger Avatar answered Sep 23 '22 16:09

codingbadger