Showing posts with label connection. Show all posts
Showing posts with label connection. Show all posts

Thursday, March 29, 2012

FTP Task samples

I am using SQL Server 2005 - CTP June 2005 and I am trying to create a simple FTP task. After I create a new FTP Connection Manager and verify the connection, I drag an FTP Task object to the designer and set the FtpConnection property to my FTP Connection Manager. The designer is showing a red X in the FTP Task object with the following error:

Attempt to read message string 0xc002f313 failed with error 0xc02090f3. Make sure all message re...

Any ideas? I am also trying to locate some samples for using the FTP Task. Can anyone point me in the right direction?

Thank you.
Clay BenoitHi Clay
This is a validation error telling you to complete the properties in the FTP dialog, either select send or the receive option with complete valid paths
for example of FTP please try the http://www.sqlis.com/

Thanks|||Perhaps it's this error? http://lab.msdn.microsoft.com/ProductFeedback/viewFeedback.aspx?feedbackid=40987f12-a941-46b3-ad80-01f67ff25559

FTP Task issue

The FTP Task I've created fails. It appears to be making the connection initially behind a firewall, but it suddenly switches from port 21 to port 3397. Anyone experience this issue? Since my firewall is restricting the connection to just port 21, I can't make a permanent connection.

FTP use 2 ports for it work - one for control connection (21) and one for data connection (any other, 3397 in your case, but may be other).|||When a ran a test comparison between the SSIS FTP Task and ftp command line, I only saw this difference when the SSIS FTP Task ran. Is this two-port usage specific to SSIS? I'm able to get out past the firewall using the ftp command without errors. I can't with SSIS.|||FTP use 2 ports by design (you can read RFC about it). Control connection used to transport commands and most simple responses, but file data transferred by data connection, which is open and live while particular transfer goes on.|||I ran a check again and did see windows command-line ftp sending the data transfer on port 20. Thanks.|||

Your problem is this: FTP normally uses ports 20 & 21. But, if you run in passive mode then the remote server will dynamically allocate a port number to you. So, the trick is to run in ACTIVE mode and then you will always run on ports 20 & 21.

If you are running on visual basic and I can let you have some source code to do this.

FTP Task Connection Problem

Problem: my FTP Connection Manager cannot connect to the FTP service specified in its configuration parameters. When I execute the FTP Task hooked to that connection manager I get the following error:

[FTP Task] Error: Unable to connect to FTP server using "FTP Connection Manager".

When I test the FTP service using FTP from a command prompt on the same workstation using the same parameters it connects just fine.

When I attempt to edit the settings in the FTP Connection Manager, the editor window pops up and then immediately disappears which is another problem. As I watch closely I can see that the username property is set to my domain login, not the value I typed in when I created it.

So I used the property sheet for the manager to set all the parameters correctly. However it still will not connect. Am I missing something? I've seen posts concerning issues connecting to UNIX/LINUX based FTP services. This particular service is hosted on a LINUX box. TIA.

I am not sure if this gona work for you or not but no harm trying it out, because this worked out for me. For example:

ftp://myservername/

if you type this in windows explorer then it prompts you for username and password.

Fillout the property page as follows:

Server Name: myservername (Do not use ftp:// prefix or the / suffix)

Port No.: 21 (in not changed)

Verify this with 'Test Connection' button.

Tuesday, March 27, 2012

FTP Problem

Afternoon...

I am trying to create an SSIS ftp task and can't even get a test connection to succeed.

I am behind a firewall and using a proxy...is it possible that is my problem? If so, is there a work-around?

TIA

Tena

The firewall and/or proxy are quite probably the issue. Talk to you IT/network support in the first instance and see what the options are for you getting access to FTP outside the LAN. This will determine how you configure the task.|||Probably too obvious to be the problem but I found that unless I prefix the user name with the domain (as in DDDDDD\UUUUUUU where d indicates the domain and U indicates the user name) then I couldn't get a test connection to succeed either. But, if you are an AD user in a domain trying to get to a ftp server that is not open to anonymous access, etc. in the domain, it might be worth checkiing.

FTP file using DTS package

I have a DTS package which does the following
1. EXECUTE SQL TASK (query in it)
on success
2. Microsoft OLE DB (database connection)
transform data task
3. Text File Destination (creates a text file TEST in a folder)
on success
4. FTP ( I WANT TO FTP THIS FILE TO A SITE)
The problem is I click on the FILE TRANSFER PROTOCOL TASK
and its asks me to enter the FTP SITE USERNAME AND PASSWORD
and then the destination DIRECTORY PATH.
I don't know the path. What do I need to mention here
Also when I click on file and select a Blank Text file from there
and check overwrite still after the task is complete data does not
appears in that.
ALTHOUGH IT SAYS TASK SUCCESSFUL even if I leave the destination
Directory path BLANK.
Does anyone knows how to figure this out. I am sure its a simple
solution.VJ:
What do you mean you do not know the path? If you were to manually upload
the file to an ftp site you would type in the ftp site. For example:
ftp.access.com. If this was a valid ftp site then I would be taken to the
folder where I needed to send my files. This is usually a setting that is
set up by the company in charge of the ftp site.
So when you set up the FTP on DTS you would chose internet as the source,
enter your username and password. On the path you would use :ftp.access.com.
I would need to know more information on your file move or overwrite
problem. Does the problem exist when you move the file from your file that
you created to the ftp site? Maybe once you get the FTP path configured
correctly you will not have this problem.
--
Thanks Kllyj64
"VJ" wrote:
> I have a DTS package which does the following
>
> 1. EXECUTE SQL TASK (query in it)
> on success
> 2. Microsoft OLE DB (database connection)
> transform data task
> 3. Text File Destination (creates a text file TEST in a folder)
> on success
> 4. FTP ( I WANT TO FTP THIS FILE TO A SITE)
> The problem is I click on the FILE TRANSFER PROTOCOL TASK
> and its asks me to enter the FTP SITE USERNAME AND PASSWORD
> and then the destination DIRECTORY PATH.
> I don't know the path. What do I need to mention here
> Also when I click on file and select a Blank Text file from there
> and check overwrite still after the task is complete data does not
> appears in that.
> ALTHOUGH IT SAYS TASK SUCCESSFUL even if I leave the destination
> Directory path BLANK.
>
> Does anyone knows how to figure this out. I am sure its a simple
> solution.
>|||VJ wrote:
> I have a DTS package which does the following
>
> 1. EXECUTE SQL TASK (query in it)
> on success
> 2. Microsoft OLE DB (database connection)
> transform data task
> 3. Text File Destination (creates a text file TEST in a folder)
> on success
> 4. FTP ( I WANT TO FTP THIS FILE TO A SITE)
> The problem is I click on the FILE TRANSFER PROTOCOL TASK
> and its asks me to enter the FTP SITE USERNAME AND PASSWORD
> and then the destination DIRECTORY PATH.
> I don't know the path. What do I need to mention here
> Also when I click on file and select a Blank Text file from there
> and check overwrite still after the task is complete data does not
> appears in that.
> ALTHOUGH IT SAYS TASK SUCCESSFUL even if I leave the destination
> Directory path BLANK.
>
> Does anyone knows how to figure this out. I am sure its a simple
> solution.
>
Hi
I think the problem is that the FTP task is only only able to download
files from an FTP site - not upload.
Instead you can create a bat file with the commands for the files you
want to upload and then execute this bat file from your DTS package.
That's the way I'm doing it and that works fine.
Regards
Steen Schlüter Persson
DBAsql

FTP file using DTS package

I have a DTS package which does the following
1. EXECUTE SQL TASK (query in it)
on success
2. Microsoft OLE DB (database connection)
transform data task
3. Text File Destination (creates a text file TEST in a folder)
on success
4. FTP ( I WANT TO FTP THIS FILE TO A SITE)
The problem is I click on the FILE TRANSFER PROTOCOL TASK
and its asks me to enter the FTP SITE USERNAME AND PASSWORD
and then the destination DIRECTORY PATH.
I don't know the path. What do I need to mention here
Also when I click on file and select a Blank Text file from there
and check overwrite still after the task is complete data does not
appears in that.
ALTHOUGH IT SAYS TASK SUCCESSFUL even if I leave the destination
Directory path BLANK.
Does anyone knows how to figure this out. I am sure its a simple
solution.VJ:
What do you mean you do not know the path? If you were to manually upload
the file to an ftp site you would type in the ftp site. For example:
ftp.access.com. If this was a valid ftp site then I would be taken to the
folder where I needed to send my files. This is usually a setting that is
set up by the company in charge of the ftp site.
So when you set up the FTP on DTS you would chose internet as the source,
enter your username and password. On the path you would use :ftp.access.com
.
I would need to know more information on your file move or overwrite
problem. Does the problem exist when you move the file from your file that
you created to the ftp site? Maybe once you get the FTP path configured
correctly you will not have this problem.
--
Thanks Kllyj64
"VJ" wrote:

> I have a DTS package which does the following
>
> 1. EXECUTE SQL TASK (query in it)
> on success
> 2. Microsoft OLE DB (database connection)
> transform data task
> 3. Text File Destination (creates a text file TEST in a folder)
> on success
> 4. FTP ( I WANT TO FTP THIS FILE TO A SITE)
> The problem is I click on the FILE TRANSFER PROTOCOL TASK
> and its asks me to enter the FTP SITE USERNAME AND PASSWORD
> and then the destination DIRECTORY PATH.
> I don't know the path. What do I need to mention here
> Also when I click on file and select a Blank Text file from there
> and check overwrite still after the task is complete data does not
> appears in that.
> ALTHOUGH IT SAYS TASK SUCCESSFUL even if I leave the destination
> Directory path BLANK.
>
> Does anyone knows how to figure this out. I am sure its a simple
> solution.
>|||VJ wrote:
> I have a DTS package which does the following
>
> 1. EXECUTE SQL TASK (query in it)
> on success
> 2. Microsoft OLE DB (database connection)
> transform data task
> 3. Text File Destination (creates a text file TEST in a folder)
> on success
> 4. FTP ( I WANT TO FTP THIS FILE TO A SITE)
> The problem is I click on the FILE TRANSFER PROTOCOL TASK
> and its asks me to enter the FTP SITE USERNAME AND PASSWORD
> and then the destination DIRECTORY PATH.
> I don't know the path. What do I need to mention here
> Also when I click on file and select a Blank Text file from there
> and check overwrite still after the task is complete data does not
> appears in that.
> ALTHOUGH IT SAYS TASK SUCCESSFUL even if I leave the destination
> Directory path BLANK.
>
> Does anyone knows how to figure this out. I am sure its a simple
> solution.
>
Hi
I think the problem is that the FTP task is only only able to download
files from an FTP site - not upload.
Instead you can create a bat file with the commands for the files you
want to upload and then execute this bat file from your DTS package.
That's the way I'm doing it and that works fine.
Regards
Steen Schlter Persson
DBA

FTP Connection problem with "The Password was not allowed" error message

Hi

I have a simple FTP task that I am trying to connect to an FTP server. I can test the connection fine, however, when I try and execute the package from Visual Studio 2005 I get the "The Password was not allowed" message. I have found some threads that mention setting the protection level on the package to EncryptSensitiveWithPassword, however, I still get the same message appearing.

Has anyone any idea as to what is causing this and how I can get around it

Thanks

Darrell

The error comes from the FTP server due to a invalid password. Can you tell me what is the value ProtectionLevel property in the Package?


Thanks,

Ovidiu Burlacu

|||EncryptSensitiveWithPassword means you have to enter a password in the package properties. You have specified the wrong password there, most likely.

For running in BIDS, EncryptSensitiveWithUserKey is just fine.|||

I had set the PackageProtection to EncryptSensitiveWithPassword, but that didn't work either.

As for an incorrect password, this can't be correct, because when I test the FTP connection it works fine

Any other thoughts ?

Thanks

D

FTP connection only works in BIDS

I have an FTP task that will only work when running in BIDS.

When trying to run as a package on the server or calling the package from a job, I get the following error in the log file:

OnError,<servername>,<user>,FTP Task,{B2F5BB68-C6F8-4EE5-ABC0-71C3636E3E4A},{B7B41A88-18DD-4AD7-8CDE-9E0C1B74DA02},6/26/2007 12:09:11 PM,6/26/2007 12:09:11 PM,-1073573489,0x,Unable to connect to FTP server using "FTP Connection Manager".

When running in BIDS it is fine.

Any know what is causing this?

Can you access the ftp site when RDP'd onto the server? My guess it is blocked.|||

we tried that

we used the old cmd file that was being called by the 'execute' task and it works fine on the server

can connect to ftp, can login, can transfer file, can rename

|||

When trying the command file, was that from a job -

- created in the same was as the SSIS job

- owned by the same SQL user

- and using the same proxy account if one is used at all?

Those points would effect the security context used to host the process within Windows, which in turn may impact credentials passed to the FTP service, or even just having network access or proxy access.

|||

It is because the security level was wiping the passwords when it was deployed.

We have now set it to use a password and it works ok.

|||

I am trying in vain to do the same. When deployed and ran the SSIS job it fails at the FTP Connection. Can you please sent me the format for FTP Connection used in SSIS jobs?

|||

Reji George wrote:

I am trying in vain to do the same. When deployed and ran the SSIS job it fails at the FTP Connection. Can you please sent me the format for FTP Connection used in SSIS jobs?

There really isn't a set "format." You just fill in the blanks for server, user name, password, etc...

Did you take note of the Package ProtectionLevel property message above?

FTP Connection Manager: Set FTP password using a variable

Hi,

I want to setup an FTP task that is portable in the sense that all it's connection parameters are stored in variables.

I can create expressions for properties ServerName and ServerUserName but not the ServerUserpassword. Is there an property that I missed, there seems to be properties for everything else except the key piece of info, the password.

I could create a script component using the FtpClientConnection method as a last resort but would rather not.

Any ideas?

Thanks

Ignore this thread, I wasn't thinking straight last night. I can use a config file to dynamically set the password.

Thanks|||I am trying to have the package load the password for an ftp site from a configuration file like you did. I cannot get it to work. How did you get it to work? Because it is sensitive information it does not get saved to the configuration file. I tried setting the package protection level to 'EncryptSensitiveWithPassword'. What did you use for the package protection level? Where are you storing you configuration file: SqlServer table or file system?|||

ProtectionLevel does not have any effect if the password is stored in a configuration file.

The password does not get stored in the configuration file by SSIS as this was considered a security risk. You have to add it there yourself. That way you, not the software, are accountable for storing it there.

-Jamie

|||

Jamie,

Thanks. As usual your answer was spot on. Cheers.

|||I'm a newbie at SSIS. I still don't understand from this thread, how to set the password. I have a list of ip/user/pass values in a table. How can I set the password on the connection manager dynamically?

Thanks in advance!|||

Same Problem here. It looks like a password can be set only indirectly by setting the full ConnectionString. For example the following script

Public Sub Main()

Dim conn As ConnectionManager = Dts.Connections("testConn")
conn.ConnectionString="Data Source=MySQLServer;User ID=sa;Password=test;Initial Catalog=TestDb;Provider=SQLNCLI.1;"

Dts.TaskResult = Dts.Results.Success

End Sub

can modify an existing SQL Server Connection including the password. Note the password is removed immediatly from the string after setting it this way, but it seems it is still stored internally.

In an analogous way it should be possible to modify an existing FTP Connection. Sadly, I don't know the syntax for that type of connection.

MsgBox'ing the ConnectionString for an FTP Connection looks like 168.192.1.2:21 and does not even include the ServerUserName.

|||

Here is c# example code for this issue.

{
......
.....
string userName = "your username of the ftp";
string password = "Your password of the ftp";

etlPackage.Connections["FTP Connection Manager"].ConnectionString =
"Data Source=MySQLServer;User ID=sa;Password=test;Initial Catalog=TestDbCatalog=TestDb;" <-- keep in mind no "Provider"
object ftpConnectionManager = (object)etlPackage.Connections["FTP Connection Manager"];
etlPackage.Connections["FTP Connection Manager"].Properties["ServerUserName"].SetValue(ftpConnectionManager, userName);
etlPackage.Connections["FTP Connection Manager"].Properties["ServerPassword"].SetValue(ftpConnectionManager, password);
.......
.......
}

Then it will work.
If you need more information, let me know.
Pls,,, keep in mind, if you include "Provider" and "Auto Translate" info items within the connection string, you will get error.

|||Many thanks. I got the message "cast to object and then use SetValue" und will try it at the next opportunity.|||

Thanks for this thread, it has helped a lot.

I set the password in the config file manually as suggested, but now I get this error: The password was not allowed.

What is causing this and how do I fix it?

Thanks for your help.

Randy

|||

Hi,

Try to set up a variable and set its value to the Connection expression in the FTP Task.
=> right click on the FTP Connection Manager and then select edit. Add a new expression for Connection and set it to the variable you have set up to store this value.This variable can be changed at runtime using Package Configurations.

Expression - ConnectionString -

"Server IP: Port.loginAccount.loginPWD"

EX: "192.168.1.1:21"+ @.[user::FtpAcct]+"."+ @.[user::FtpPwd]

|||

Hi,

Can you double check this syntax, please? It looks like that example doesn't match syntax provided!

I have tried several combinations of this parameters but neither didn't work! Did you get solved this problem? What else need to be set to get this concept working?

I can't beleive that MS didn't publish standard solution on such a genuine common requirement? Again!!!

Thanks Forward

Sladjan

|||

clovernet wrote:

Hi,

Try to set up a variable and set its value to the Connection expression in the FTP Task.

=> right click on the FTP Connection Manager and then select edit. Add a new expression for Connection and set it to the variable you have set up to store this value.This variable can be changed at runtime using Package Configurations.

Expression - ConnectionString -

"Server IP: Port.loginAccount.loginPWD"

EX: "192.168.1.1:21"+ @.[user::FtpAcct]+"."+ @.[user::FtpPwd]

Example should be "192.168.1.1:21." + @.[user::FtpAcct]+"."+ @.[user::FtpPwd] (it's missing the period after the port)

I've used the above and it works great. I would have NEVER figured this out without someone posting (THANK YOU CLOVER!!!)... Actually got all variables from a table through an SQL task that reads a view of FTP Info and directories/files to ftp. Since we FTP from multiple servers and multiple files/remote directories, we just put the FTP Task in a For Each loop. Did the concatenation for the ConnectionString in the FTP Connection manager as clovernet suggested @.user::varFTPIPAddress] + ":21." + @.[user::varFTPUser]+"."+ @.[user::varFtpPwd]

My issue is that on the FTP task, if I pass it "\directory\subdirectory\filename.ext" for the remote path (from a variable), I get an error message that the remote path doesn't start with a "/". When I reversed the slashes, it worked fine.... Why can the local/destination path have back slashes ("\"), but the remote/source path must have forward slashes? What the heck!!!

|||

I can't get the connection string to work. I can use a script task to use the variables to perform FTP operations but the only way I can set the password in a connection is via the config. It gives the error "Password not available" whenever I try to set it - that's in an expression or script setting the configuration string (as above) or in a script task setting the serverpassword. I'm guessing it's because it tries to read the value before setting it. Anyone know a way around this?

I need the password in a variable for the script tasks for thnigs that can't be done with an ftp task but the mget is easier in the ftp task. At the moment it requires two config entries for the same value.

|||

Dan,

I have tried a several combination of that example (including a period you are suggesting) but didn't get it working. It has to be sometjing else on the configuration to prevent pasing of the connection string on a same manner as you and Clover were suggesting. Thanks guys for your contributions, anyway.

Dan, try to use "/" for source and target destinations, both. Windows is able to handle both of them and you would not have a problem on ftp server and would not bring you confusion.

-

Nigel, here is what I have done and got it working by using package variables and VB.NET script task. It is more/less around few ideas sugested above:

Firstly I declared the set of variables for each of the relevant ftp parameters. Than prior FTP task I set following script task passing all of those variables as parameters.

Public Sub Main()

Dim ftpConnectionManager As ConnectionManager

ftpConnectionManager = Dts.Connections("FTP Connection Manager")

Dts.Connections("FTP Connection Manager").Properties("ServerName").SetValue(ftpConnectionManager, Dts.Variables("FtpServer").Value)

Dts.Connections("FTP Connection Manager").Properties("ServerPort").SetValue(ftpConnectionManager, Dts.Variables("FtpPort").Value)

Dts.Connections("FTP Connection Manager").Properties("ServerUserName").SetValue(ftpConnectionManager, Dts.Variables("FtpUser").Value)

Dts.Connections("FTP Connection Manager").Properties("ServerPassword").SetValue(ftpConnectionManager, Dts.Variables("FtpPassword").Value)

Dts.TaskResult = Dts.Results.Success

End Sub

Than remove values from the all non mandatory fields on FTP connection manager and disable validation.

On FTP task itself I parametrized destination folder (by using "/" inside the string) and source file connection.

All together, for each ftp server and each registered file I got FTP running in a loop sending each file on different designated server. And it works!

Sladjan

sql

FTP Connection Manager: Set FTP password using a variable

Hi,

I want to setup an FTP task that is portable in the sense that all it's connection parameters are stored in variables.

I can create expressions for properties ServerName and ServerUserName but not the ServerUserpassword. Is there an property that I missed, there seems to be properties for everything else except the key piece of info, the password.

I could create a script component using the FtpClientConnection method as a last resort but would rather not.

Any ideas?

Thanks

Ignore this thread, I wasn't thinking straight last night. I can use a config file to dynamically set the password.

Thanks|||I am trying to have the package load the password for an ftp site from a configuration file like you did. I cannot get it to work. How did you get it to work? Because it is sensitive information it does not get saved to the configuration file. I tried setting the package protection level to 'EncryptSensitiveWithPassword'. What did you use for the package protection level? Where are you storing you configuration file: SqlServer table or file system?|||

ProtectionLevel does not have any effect if the password is stored in a configuration file.

The password does not get stored in the configuration file by SSIS as this was considered a security risk. You have to add it there yourself. That way you, not the software, are accountable for storing it there.

-Jamie

|||

Jamie,

Thanks. As usual your answer was spot on. Cheers.

|||I'm a newbie at SSIS. I still don't understand from this thread, how to set the password. I have a list of ip/user/pass values in a table. How can I set the password on the connection manager dynamically?

Thanks in advance!
|||

Same Problem here. It looks like a password can be set only indirectly by setting the full ConnectionString. For example the following script

Public Sub Main()

Dim conn As ConnectionManager = Dts.Connections("testConn")
conn.ConnectionString="Data Source=MySQLServer;User ID=sa;Password=test;Initial Catalog=TestDb;Provider=SQLNCLI.1;"

Dts.TaskResult = Dts.Results.Success

End Sub

can modify an existing SQL Server Connection including the password. Note the password is removed immediatly from the string after setting it this way, but it seems it is still stored internally.

In an analogous way it should be possible to modify an existing FTP Connection. Sadly, I don't know the syntax for that type of connection.

MsgBox'ing the ConnectionString for an FTP Connection looks like 168.192.1.2:21 and does not even include the ServerUserName.

|||

Here is c# example code for this issue.

{
......
.....
string userName = "your username of the ftp";
string password = "Your password of the ftp";

etlPackage.Connections["FTP Connection Manager"].ConnectionString =
"Data Source=MySQLServer;User ID=sa;Password=test;Initial Catalog=TestDbCatalog=TestDb;" <-- keep in mind no "Provider"
object ftpConnectionManager = (object)etlPackage.Connections["FTP Connection Manager"];
etlPackage.Connections["FTP Connection Manager"].Properties["ServerUserName"].SetValue(ftpConnectionManager, userName);
etlPackage.Connections["FTP Connection Manager"].Properties["ServerPassword"].SetValue(ftpConnectionManager, password);
.......
.......
}

Then it will work.
If you need more information, let me know.
Pls,,, keep in mind, if you include "Provider" and "Auto Translate" info items within the connection string, you will get error.

|||Many thanks. I got the message "cast to object and then use SetValue" und will try it at the next opportunity.|||

Thanks for this thread, it has helped a lot.

I set the password in the config file manually as suggested, but now I get this error: The password was not allowed.

What is causing this and how do I fix it?

Thanks for your help.

Randy

|||

Hi,

Try to set up a variable and set its value to the Connection expression in the FTP Task.
=> right click on the FTP Connection Manager and then select edit. Add a new expression for Connection and set it to the variable you have set up to store this value.This variable can be changed at runtime using Package Configurations.

Expression - ConnectionString -

"Server IP: Port.loginAccount.loginPWD"

EX: "192.168.1.1:21"+ @.[user::FtpAcct]+"."+ @.[user::FtpPwd]

|||

Hi,

Can you double check this syntax, please? It looks like that example doesn't match syntax provided!

I have tried several combinations of this parameters but neither didn't work! Did you get solved this problem? What else need to be set to get this concept working?

I can't beleive that MS didn't publish standard solution on such a genuine common requirement? Again!!!

Thanks Forward

Sladjan

|||

clovernet wrote:

Hi,

Try to set up a variable and set its value to the Connection expression in the FTP Task.

=> right click on the FTP Connection Manager and then select edit. Add a new expression for Connection and set it to the variable you have set up to store this value.This variable can be changed at runtime using Package Configurations.

Expression - ConnectionString -

"Server IP: Port.loginAccount.loginPWD"

EX: "192.168.1.1:21"+ @.[user::FtpAcct]+"."+ @.[user::FtpPwd]

Example should be "192.168.1.1:21." + @.[user::FtpAcct]+"."+ @.[user::FtpPwd] (it's missing the period after the port)

I've used the above and it works great. I would have NEVER figured this out without someone posting (THANK YOU CLOVER!!!)... Actually got all variables from a table through an SQL task that reads a view of FTP Info and directories/files to ftp. Since we FTP from multiple servers and multiple files/remote directories, we just put the FTP Task in a For Each loop. Did the concatenation for the ConnectionString in the FTP Connection manager as clovernet suggested @.user::varFTPIPAddress] + ":21." + @.[user::varFTPUser]+"."+ @.[user::varFtpPwd]

My issue is that on the FTP task, if I pass it "\directory\subdirectory\filename.ext" for the remote path (from a variable), I get an error message that the remote path doesn't start with a "/". When I reversed the slashes, it worked fine.... Why can the local/destination path have back slashes ("\"), but the remote/source path must have forward slashes? What the heck!!!

|||

I can't get the connection string to work. I can use a script task to use the variables to perform FTP operations but the only way I can set the password in a connection is via the config. It gives the error "Password not available" whenever I try to set it - that's in an expression or script setting the configuration string (as above) or in a script task setting the serverpassword. I'm guessing it's because it tries to read the value before setting it. Anyone know a way around this?

I need the password in a variable for the script tasks for thnigs that can't be done with an ftp task but the mget is easier in the ftp task. At the moment it requires two config entries for the same value.

|||

Dan,

I have tried a several combination of that example (including a period you are suggesting) but didn't get it working. It has to be sometjing else on the configuration to prevent pasing of the connection string on a same manner as you and Clover were suggesting. Thanks guys for your contributions, anyway.

Dan, try to use "/" for source and target destinations, both. Windows is able to handle both of them and you would not have a problem on ftp server and would not bring you confusion.

-

Nigel, here is what I have done and got it working by using package variables and VB.NET script task. It is more/less around few ideas sugested above:

Firstly I declared the set of variables for each of the relevant ftp parameters. Than prior FTP task I set following script task passing all of those variables as parameters.

Public Sub Main()

Dim ftpConnectionManager As ConnectionManager

ftpConnectionManager = Dts.Connections("FTP Connection Manager")

Dts.Connections("FTP Connection Manager").Properties("ServerName").SetValue(ftpConnectionManager, Dts.Variables("FtpServer").Value)

Dts.Connections("FTP Connection Manager").Properties("ServerPort").SetValue(ftpConnectionManager, Dts.Variables("FtpPort").Value)

Dts.Connections("FTP Connection Manager").Properties("ServerUserName").SetValue(ftpConnectionManager, Dts.Variables("FtpUser").Value)

Dts.Connections("FTP Connection Manager").Properties("ServerPassword").SetValue(ftpConnectionManager, Dts.Variables("FtpPassword").Value)

Dts.TaskResult = Dts.Results.Success

End Sub

Than remove values from the all non mandatory fields on FTP connection manager and disable validation.

On FTP task itself I parametrized destination folder (by using "/" inside the string) and source file connection.

All together, for each ftp server and each registered file I got FTP running in a loop sending each file on different designated server. And it works!

Sladjan

FTP Connection Manager: Set FTP password using a variable

Hi,

I want to setup an FTP task that is portable in the sense that all it's connection parameters are stored in variables.

I can create expressions for properties ServerName and ServerUserName but not the ServerUserpassword. Is there an property that I missed, there seems to be properties for everything else except the key piece of info, the password.

I could create a script component using the FtpClientConnection method as a last resort but would rather not.

Any ideas?

Thanks

Ignore this thread, I wasn't thinking straight last night. I can use a config file to dynamically set the password.

Thanks|||I am trying to have the package load the password for an ftp site from a configuration file like you did. I cannot get it to work. How did you get it to work? Because it is sensitive information it does not get saved to the configuration file. I tried setting the package protection level to 'EncryptSensitiveWithPassword'. What did you use for the package protection level? Where are you storing you configuration file: SqlServer table or file system?|||

ProtectionLevel does not have any effect if the password is stored in a configuration file.

The password does not get stored in the configuration file by SSIS as this was considered a security risk. You have to add it there yourself. That way you, not the software, are accountable for storing it there.

-Jamie

|||

Jamie,

Thanks. As usual your answer was spot on. Cheers.

|||I'm a newbie at SSIS. I still don't understand from this thread, how to set the password. I have a list of ip/user/pass values in a table. How can I set the password on the connection manager dynamically?

Thanks in advance!
|||

Same Problem here. It looks like a password can be set only indirectly by setting the full ConnectionString. For example the following script

Public Sub Main()

Dim conn As ConnectionManager = Dts.Connections("testConn")
conn.ConnectionString="Data Source=MySQLServer;User ID=sa;Password=test;Initial Catalog=TestDb;Provider=SQLNCLI.1;"

Dts.TaskResult = Dts.Results.Success

End Sub

can modify an existing SQL Server Connection including the password. Note the password is removed immediatly from the string after setting it this way, but it seems it is still stored internally.

In an analogous way it should be possible to modify an existing FTP Connection. Sadly, I don't know the syntax for that type of connection.

MsgBox'ing the ConnectionString for an FTP Connection looks like 168.192.1.2:21 and does not even include the ServerUserName.

|||

Here is c# example code for this issue.

{
......
.....
string userName = "your username of the ftp";
string password = "Your password of the ftp";

etlPackage.Connections["FTP Connection Manager"].ConnectionString =
"Data Source=MySQLServer;User ID=sa;Password=test;Initial Catalog=TestDbCatalog=TestDb;" <-- keep in mind no "Provider"
object ftpConnectionManager = (object)etlPackage.Connections["FTP Connection Manager"];
etlPackage.Connections["FTP Connection Manager"].Properties["ServerUserName"].SetValue(ftpConnectionManager, userName);
etlPackage.Connections["FTP Connection Manager"].Properties["ServerPassword"].SetValue(ftpConnectionManager, password);
.......
.......
}

Then it will work.
If you need more information, let me know.
Pls,,, keep in mind, if you include "Provider" and "Auto Translate" info items within the connection string, you will get error.

|||Many thanks. I got the message "cast to object and then use SetValue" und will try it at the next opportunity.|||

Thanks for this thread, it has helped a lot.

I set the password in the config file manually as suggested, but now I get this error: The password was not allowed.

What is causing this and how do I fix it?

Thanks for your help.

Randy

|||

Hi,

Try to set up a variable and set its value to the Connection expression in the FTP Task.
=> right click on the FTP Connection Manager and then select edit. Add a new expression for Connection and set it to the variable you have set up to store this value.This variable can be changed at runtime using Package Configurations.

Expression - ConnectionString -

"Server IP: Port.loginAccount.loginPWD"

EX: "192.168.1.1:21"+ @.[user::FtpAcct]+"."+ @.[user::FtpPwd]

|||

Hi,

Can you double check this syntax, please? It looks like that example doesn't match syntax provided!

I have tried several combinations of this parameters but neither didn't work! Did you get solved this problem? What else need to be set to get this concept working?

I can't beleive that MS didn't publish standard solution on such a genuine common requirement? Again!!!

Thanks Forward

Sladjan

|||

clovernet wrote:

Hi,

Try to set up a variable and set its value to the Connection expression in the FTP Task.

=> right click on the FTP Connection Manager and then select edit. Add a new expression for Connection and set it to the variable you have set up to store this value.This variable can be changed at runtime using Package Configurations.

Expression - ConnectionString -

"Server IP: Port.loginAccount.loginPWD"

EX: "192.168.1.1:21"+ @.[user::FtpAcct]+"."+ @.[user::FtpPwd]

Example should be "192.168.1.1:21." + @.[user::FtpAcct]+"."+ @.[user::FtpPwd] (it's missing the period after the port)

I've used the above and it works great. I would have NEVER figured this out without someone posting (THANK YOU CLOVER!!!)... Actually got all variables from a table through an SQL task that reads a view of FTP Info and directories/files to ftp. Since we FTP from multiple servers and multiple files/remote directories, we just put the FTP Task in a For Each loop. Did the concatenation for the ConnectionString in the FTP Connection manager as clovernet suggested @.user::varFTPIPAddress] + ":21." + @.[user::varFTPUser]+"."+ @.[user::varFtpPwd]

My issue is that on the FTP task, if I pass it "\directory\subdirectory\filename.ext" for the remote path (from a variable), I get an error message that the remote path doesn't start with a "/". When I reversed the slashes, it worked fine.... Why can the local/destination path have back slashes ("\"), but the remote/source path must have forward slashes? What the heck!!!

|||

I can't get the connection string to work. I can use a script task to use the variables to perform FTP operations but the only way I can set the password in a connection is via the config. It gives the error "Password not available" whenever I try to set it - that's in an expression or script setting the configuration string (as above) or in a script task setting the serverpassword. I'm guessing it's because it tries to read the value before setting it. Anyone know a way around this?

I need the password in a variable for the script tasks for thnigs that can't be done with an ftp task but the mget is easier in the ftp task. At the moment it requires two config entries for the same value.

|||

Dan,

I have tried a several combination of that example (including a period you are suggesting) but didn't get it working. It has to be sometjing else on the configuration to prevent pasing of the connection string on a same manner as you and Clover were suggesting. Thanks guys for your contributions, anyway.

Dan, try to use "/" for source and target destinations, both. Windows is able to handle both of them and you would not have a problem on ftp server and would not bring you confusion.

-

Nigel, here is what I have done and got it working by using package variables and VB.NET script task. It is more/less around few ideas sugested above:

Firstly I declared the set of variables for each of the relevant ftp parameters. Than prior FTP task I set following script task passing all of those variables as parameters.

Public Sub Main()

Dim ftpConnectionManager As ConnectionManager

ftpConnectionManager = Dts.Connections("FTP Connection Manager")

Dts.Connections("FTP Connection Manager").Properties("ServerName").SetValue(ftpConnectionManager, Dts.Variables("FtpServer").Value)

Dts.Connections("FTP Connection Manager").Properties("ServerPort").SetValue(ftpConnectionManager, Dts.Variables("FtpPort").Value)

Dts.Connections("FTP Connection Manager").Properties("ServerUserName").SetValue(ftpConnectionManager, Dts.Variables("FtpUser").Value)

Dts.Connections("FTP Connection Manager").Properties("ServerPassword").SetValue(ftpConnectionManager, Dts.Variables("FtpPassword").Value)

Dts.TaskResult = Dts.Results.Success

End Sub

Than remove values from the all non mandatory fields on FTP connection manager and disable validation.

On FTP task itself I parametrized destination folder (by using "/" inside the string) and source file connection.

All together, for each ftp server and each registered file I got FTP running in a loop sending each file on different designated server. And it works!

Sladjan

Monday, March 26, 2012

FTP Connection Manager: Set FTP password using a variable

Hi,

I want to setup an FTP task that is portable in the sense that all it's connection parameters are stored in variables.

I can create expressions for properties ServerName and ServerUserName but not the ServerUserpassword. Is there an property that I missed, there seems to be properties for everything else except the key piece of info, the password.

I could create a script component using the FtpClientConnection method as a last resort but would rather not.

Any ideas?

Thanks

Ignore this thread, I wasn't thinking straight last night. I can use a config file to dynamically set the password.

Thanks|||I am trying to have the package load the password for an ftp site from a configuration file like you did. I cannot get it to work. How did you get it to work? Because it is sensitive information it does not get saved to the configuration file. I tried setting the package protection level to 'EncryptSensitiveWithPassword'. What did you use for the package protection level? Where are you storing you configuration file: SqlServer table or file system?|||

ProtectionLevel does not have any effect if the password is stored in a configuration file.

The password does not get stored in the configuration file by SSIS as this was considered a security risk. You have to add it there yourself. That way you, not the software, are accountable for storing it there.

-Jamie

|||

Jamie,

Thanks. As usual your answer was spot on. Cheers.

|||I'm a newbie at SSIS. I still don't understand from this thread, how to set the password. I have a list of ip/user/pass values in a table. How can I set the password on the connection manager dynamically?

Thanks in advance!
|||

Same Problem here. It looks like a password can be set only indirectly by setting the full ConnectionString. For example the following script

Public Sub Main()

Dim conn As ConnectionManager = Dts.Connections("testConn")
conn.ConnectionString="Data Source=MySQLServer;User ID=sa;Password=test;Initial Catalog=TestDb;Provider=SQLNCLI.1;"

Dts.TaskResult = Dts.Results.Success

End Sub

can modify an existing SQL Server Connection including the password. Note the password is removed immediatly from the string after setting it this way, but it seems it is still stored internally.

In an analogous way it should be possible to modify an existing FTP Connection. Sadly, I don't know the syntax for that type of connection.

MsgBox'ing the ConnectionString for an FTP Connection looks like 168.192.1.2:21 and does not even include the ServerUserName.

|||

Here is c# example code for this issue.

{
......
.....
string userName = "your username of the ftp";
string password = "Your password of the ftp";

etlPackage.Connections["FTP Connection Manager"].ConnectionString =
"Data Source=MySQLServer;User ID=sa;Password=test;Initial Catalog=TestDbCatalog=TestDb;" <-- keep in mind no "Provider"
object ftpConnectionManager = (object)etlPackage.Connections["FTP Connection Manager"];
etlPackage.Connections["FTP Connection Manager"].Properties["ServerUserName"].SetValue(ftpConnectionManager, userName);
etlPackage.Connections["FTP Connection Manager"].Properties["ServerPassword"].SetValue(ftpConnectionManager, password);
.......
.......
}

Then it will work.
If you need more information, let me know.
Pls,,, keep in mind, if you include "Provider" and "Auto Translate" info items within the connection string, you will get error.

|||Many thanks. I got the message "cast to object and then use SetValue" und will try it at the next opportunity.|||

Thanks for this thread, it has helped a lot.

I set the password in the config file manually as suggested, but now I get this error: The password was not allowed.

What is causing this and how do I fix it?

Thanks for your help.

Randy

|||

Hi,

Try to set up a variable and set its value to the Connection expression in the FTP Task.
=> right click on the FTP Connection Manager and then select edit. Add a new expression for Connection and set it to the variable you have set up to store this value.This variable can be changed at runtime using Package Configurations.

Expression - ConnectionString -

"Server IP: Port.loginAccount.loginPWD"

EX: "192.168.1.1:21"+ @.[user::FtpAcct]+"."+ @.[user::FtpPwd]

|||

Hi,

Can you double check this syntax, please? It looks like that example doesn't match syntax provided!

I have tried several combinations of this parameters but neither didn't work! Did you get solved this problem? What else need to be set to get this concept working?

I can't beleive that MS didn't publish standard solution on such a genuine common requirement? Again!!!

Thanks Forward

Sladjan

|||

clovernet wrote:

Hi,

Try to set up a variable and set its value to the Connection expression in the FTP Task.

=> right click on the FTP Connection Manager and then select edit. Add a new expression for Connection and set it to the variable you have set up to store this value.This variable can be changed at runtime using Package Configurations.

Expression - ConnectionString -

"Server IP: Port.loginAccount.loginPWD"

EX: "192.168.1.1:21"+ @.[user::FtpAcct]+"."+ @.[user::FtpPwd]

Example should be "192.168.1.1:21." + @.[user::FtpAcct]+"."+ @.[user::FtpPwd] (it's missing the period after the port)

I've used the above and it works great. I would have NEVER figured this out without someone posting (THANK YOU CLOVER!!!)... Actually got all variables from a table through an SQL task that reads a view of FTP Info and directories/files to ftp. Since we FTP from multiple servers and multiple files/remote directories, we just put the FTP Task in a For Each loop. Did the concatenation for the ConnectionString in the FTP Connection manager as clovernet suggested @.user::varFTPIPAddress] + ":21." + @.[user::varFTPUser]+"."+ @.[user::varFtpPwd]

My issue is that on the FTP task, if I pass it "\directory\subdirectory\filename.ext" for the remote path (from a variable), I get an error message that the remote path doesn't start with a "/". When I reversed the slashes, it worked fine.... Why can the local/destination path have back slashes ("\"), but the remote/source path must have forward slashes? What the heck!!!

|||

I can't get the connection string to work. I can use a script task to use the variables to perform FTP operations but the only way I can set the password in a connection is via the config. It gives the error "Password not available" whenever I try to set it - that's in an expression or script setting the configuration string (as above) or in a script task setting the serverpassword. I'm guessing it's because it tries to read the value before setting it. Anyone know a way around this?

I need the password in a variable for the script tasks for thnigs that can't be done with an ftp task but the mget is easier in the ftp task. At the moment it requires two config entries for the same value.

|||

Dan,

I have tried a several combination of that example (including a period you are suggesting) but didn't get it working. It has to be sometjing else on the configuration to prevent pasing of the connection string on a same manner as you and Clover were suggesting. Thanks guys for your contributions, anyway.

Dan, try to use "/" for source and target destinations, both. Windows is able to handle both of them and you would not have a problem on ftp server and would not bring you confusion.

-

Nigel, here is what I have done and got it working by using package variables and VB.NET script task. It is more/less around few ideas sugested above:

Firstly I declared the set of variables for each of the relevant ftp parameters. Than prior FTP task I set following script task passing all of those variables as parameters.

Public Sub Main()

Dim ftpConnectionManager As ConnectionManager

ftpConnectionManager = Dts.Connections("FTP Connection Manager")

Dts.Connections("FTP Connection Manager").Properties("ServerName").SetValue(ftpConnectionManager, Dts.Variables("FtpServer").Value)

Dts.Connections("FTP Connection Manager").Properties("ServerPort").SetValue(ftpConnectionManager, Dts.Variables("FtpPort").Value)

Dts.Connections("FTP Connection Manager").Properties("ServerUserName").SetValue(ftpConnectionManager, Dts.Variables("FtpUser").Value)

Dts.Connections("FTP Connection Manager").Properties("ServerPassword").SetValue(ftpConnectionManager, Dts.Variables("FtpPassword").Value)

Dts.TaskResult = Dts.Results.Success

End Sub

Than remove values from the all non mandatory fields on FTP connection manager and disable validation.

On FTP task itself I parametrized destination folder (by using "/" inside the string) and source file connection.

All together, for each ftp server and each registered file I got FTP running in a loop sending each file on different designated server. And it works!

Sladjan

FTP Connection Manager: Set FTP password using a variable

Hi,

I want to setup an FTP task that is portable in the sense that all it's connection parameters are stored in variables.

I can create expressions for properties ServerName and ServerUserName but not the ServerUserpassword. Is there an property that I missed, there seems to be properties for everything else except the key piece of info, the password.

I could create a script component using the FtpClientConnection method as a last resort but would rather not.

Any ideas?

Thanks

Ignore this thread, I wasn't thinking straight last night. I can use a config file to dynamically set the password.

Thanks|||I am trying to have the package load the password for an ftp site from a configuration file like you did. I cannot get it to work. How did you get it to work? Because it is sensitive information it does not get saved to the configuration file. I tried setting the package protection level to 'EncryptSensitiveWithPassword'. What did you use for the package protection level? Where are you storing you configuration file: SqlServer table or file system?|||

ProtectionLevel does not have any effect if the password is stored in a configuration file.

The password does not get stored in the configuration file by SSIS as this was considered a security risk. You have to add it there yourself. That way you, not the software, are accountable for storing it there.

-Jamie

|||

Jamie,

Thanks. As usual your answer was spot on. Cheers.

|||I'm a newbie at SSIS. I still don't understand from this thread, how to set the password. I have a list of ip/user/pass values in a table. How can I set the password on the connection manager dynamically?

Thanks in advance!|||

Same Problem here. It looks like a password can be set only indirectly by setting the full ConnectionString. For example the following script

Public Sub Main()

Dim conn As ConnectionManager = Dts.Connections("testConn")
conn.ConnectionString="Data Source=MySQLServer;User ID=sa;Password=test;Initial Catalog=TestDb;Provider=SQLNCLI.1;"

Dts.TaskResult = Dts.Results.Success

End Sub

can modify an existing SQL Server Connection including the password. Note the password is removed immediatly from the string after setting it this way, but it seems it is still stored internally.

In an analogous way it should be possible to modify an existing FTP Connection. Sadly, I don't know the syntax for that type of connection.

MsgBox'ing the ConnectionString for an FTP Connection looks like 168.192.1.2:21 and does not even include the ServerUserName.

|||

Here is c# example code for this issue.

{
......
.....
string userName = "your username of the ftp";
string password = "Your password of the ftp";

etlPackage.Connections["FTP Connection Manager"].ConnectionString =
"Data Source=MySQLServer;User ID=sa;Password=test;Initial Catalog=TestDbCatalog=TestDb;" <-- keep in mind no "Provider"
object ftpConnectionManager = (object)etlPackage.Connections["FTP Connection Manager"];
etlPackage.Connections["FTP Connection Manager"].Properties["ServerUserName"].SetValue(ftpConnectionManager, userName);
etlPackage.Connections["FTP Connection Manager"].Properties["ServerPassword"].SetValue(ftpConnectionManager, password);
.......
.......
}

Then it will work.
If you need more information, let me know.
Pls,,, keep in mind, if you include "Provider" and "Auto Translate" info items within the connection string, you will get error.

|||Many thanks. I got the message "cast to object and then use SetValue" und will try it at the next opportunity.|||

Thanks for this thread, it has helped a lot.

I set the password in the config file manually as suggested, but now I get this error: The password was not allowed.

What is causing this and how do I fix it?

Thanks for your help.

Randy

|||

Hi,

Try to set up a variable and set its value to the Connection expression in the FTP Task.
=> right click on the FTP Connection Manager and then select edit. Add a new expression for Connection and set it to the variable you have set up to store this value.This variable can be changed at runtime using Package Configurations.

Expression - ConnectionString -

"Server IP: Port.loginAccount.loginPWD"

EX: "192.168.1.1:21"+ @.[user::FtpAcct]+"."+ @.[user::FtpPwd]

|||

Hi,

Can you double check this syntax, please? It looks like that example doesn't match syntax provided!

I have tried several combinations of this parameters but neither didn't work! Did you get solved this problem? What else need to be set to get this concept working?

I can't beleive that MS didn't publish standard solution on such a genuine common requirement? Again!!!

Thanks Forward

Sladjan

|||

clovernet wrote:

Hi,

Try to set up a variable and set its value to the Connection expression in the FTP Task.

=> right click on the FTP Connection Manager and then select edit. Add a new expression for Connection and set it to the variable you have set up to store this value.This variable can be changed at runtime using Package Configurations.

Expression - ConnectionString -

"Server IP: Port.loginAccount.loginPWD"

EX: "192.168.1.1:21"+ @.[user::FtpAcct]+"."+ @.[user::FtpPwd]

Example should be "192.168.1.1:21." + @.[user::FtpAcct]+"."+ @.[user::FtpPwd] (it's missing the period after the port)

I've used the above and it works great. I would have NEVER figured this out without someone posting (THANK YOU CLOVER!!!)... Actually got all variables from a table through an SQL task that reads a view of FTP Info and directories/files to ftp. Since we FTP from multiple servers and multiple files/remote directories, we just put the FTP Task in a For Each loop. Did the concatenation for the ConnectionString in the FTP Connection manager as clovernet suggested @.user::varFTPIPAddress] + ":21." + @.[user::varFTPUser]+"."+ @.[user::varFtpPwd]

My issue is that on the FTP task, if I pass it "\directory\subdirectory\filename.ext" for the remote path (from a variable), I get an error message that the remote path doesn't start with a "/". When I reversed the slashes, it worked fine.... Why can the local/destination path have back slashes ("\"), but the remote/source path must have forward slashes? What the heck!!!

|||

I can't get the connection string to work. I can use a script task to use the variables to perform FTP operations but the only way I can set the password in a connection is via the config. It gives the error "Password not available" whenever I try to set it - that's in an expression or script setting the configuration string (as above) or in a script task setting the serverpassword. I'm guessing it's because it tries to read the value before setting it. Anyone know a way around this?

I need the password in a variable for the script tasks for thnigs that can't be done with an ftp task but the mget is easier in the ftp task. At the moment it requires two config entries for the same value.

|||

Dan,

I have tried a several combination of that example (including a period you are suggesting) but didn't get it working. It has to be sometjing else on the configuration to prevent pasing of the connection string on a same manner as you and Clover were suggesting. Thanks guys for your contributions, anyway.

Dan, try to use "/" for source and target destinations, both. Windows is able to handle both of them and you would not have a problem on ftp server and would not bring you confusion.

-

Nigel, here is what I have done and got it working by using package variables and VB.NET script task. It is more/less around few ideas sugested above:

Firstly I declared the set of variables for each of the relevant ftp parameters. Than prior FTP task I set following script task passing all of those variables as parameters.

Public Sub Main()

Dim ftpConnectionManager As ConnectionManager

ftpConnectionManager = Dts.Connections("FTP Connection Manager")

Dts.Connections("FTP Connection Manager").Properties("ServerName").SetValue(ftpConnectionManager, Dts.Variables("FtpServer").Value)

Dts.Connections("FTP Connection Manager").Properties("ServerPort").SetValue(ftpConnectionManager, Dts.Variables("FtpPort").Value)

Dts.Connections("FTP Connection Manager").Properties("ServerUserName").SetValue(ftpConnectionManager, Dts.Variables("FtpUser").Value)

Dts.Connections("FTP Connection Manager").Properties("ServerPassword").SetValue(ftpConnectionManager, Dts.Variables("FtpPassword").Value)

Dts.TaskResult = Dts.Results.Success

End Sub

Than remove values from the all non mandatory fields on FTP connection manager and disable validation.

On FTP task itself I parametrized destination folder (by using "/" inside the string) and source file connection.

All together, for each ftp server and each registered file I got FTP running in a loop sending each file on different designated server. And it works!

Sladjan

FTP Connection Manager: Set FTP password using a variable

Hi,

I want to setup an FTP task that is portable in the sense that all it's connection parameters are stored in variables.

I can create expressions for properties ServerName and ServerUserName but not the ServerUserpassword. Is there an property that I missed, there seems to be properties for everything else except the key piece of info, the password.

I could create a script component using the FtpClientConnection method as a last resort but would rather not.

Any ideas?

Thanks

Ignore this thread, I wasn't thinking straight last night. I can use a config file to dynamically set the password.

Thanks|||I am trying to have the package load the password for an ftp site from a configuration file like you did. I cannot get it to work. How did you get it to work? Because it is sensitive information it does not get saved to the configuration file. I tried setting the package protection level to 'EncryptSensitiveWithPassword'. What did you use for the package protection level? Where are you storing you configuration file: SqlServer table or file system?|||

ProtectionLevel does not have any effect if the password is stored in a configuration file.

The password does not get stored in the configuration file by SSIS as this was considered a security risk. You have to add it there yourself. That way you, not the software, are accountable for storing it there.

-Jamie

|||

Jamie,

Thanks. As usual your answer was spot on. Cheers.

|||I'm a newbie at SSIS. I still don't understand from this thread, how to set the password. I have a list of ip/user/pass values in a table. How can I set the password on the connection manager dynamically?

Thanks in advance!|||

Same Problem here. It looks like a password can be set only indirectly by setting the full ConnectionString. For example the following script

Public Sub Main()

Dim conn As ConnectionManager = Dts.Connections("testConn")
conn.ConnectionString="Data Source=MySQLServer;User ID=sa;Password=test;Initial Catalog=TestDb;Provider=SQLNCLI.1;"

Dts.TaskResult = Dts.Results.Success

End Sub

can modify an existing SQL Server Connection including the password. Note the password is removed immediatly from the string after setting it this way, but it seems it is still stored internally.

In an analogous way it should be possible to modify an existing FTP Connection. Sadly, I don't know the syntax for that type of connection.

MsgBox'ing the ConnectionString for an FTP Connection looks like 168.192.1.2:21 and does not even include the ServerUserName.

|||

Here is c# example code for this issue.

{
......
.....
string userName = "your username of the ftp";
string password = "Your password of the ftp";

etlPackage.Connections["FTP Connection Manager"].ConnectionString =
"Data Source=MySQLServer;User ID=sa;Password=test;Initial Catalog=TestDbCatalog=TestDb;" <-- keep in mind no "Provider"
object ftpConnectionManager = (object)etlPackage.Connections["FTP Connection Manager"];
etlPackage.Connections["FTP Connection Manager"].Properties["ServerUserName"].SetValue(ftpConnectionManager, userName);
etlPackage.Connections["FTP Connection Manager"].Properties["ServerPassword"].SetValue(ftpConnectionManager, password);
.......
.......
}

Then it will work.
If you need more information, let me know.
Pls,,, keep in mind, if you include "Provider" and "Auto Translate" info items within the connection string, you will get error.

|||Many thanks. I got the message "cast to object and then use SetValue" und will try it at the next opportunity.|||

Thanks for this thread, it has helped a lot.

I set the password in the config file manually as suggested, but now I get this error: The password was not allowed.

What is causing this and how do I fix it?

Thanks for your help.

Randy

|||

Hi,

Try to set up a variable and set its value to the Connection expression in the FTP Task.
=> right click on the FTP Connection Manager and then select edit. Add a new expression for Connection and set it to the variable you have set up to store this value.This variable can be changed at runtime using Package Configurations.

Expression - ConnectionString -

"Server IP: Port.loginAccount.loginPWD"

EX: "192.168.1.1:21"+ @.[user::FtpAcct]+"."+ @.[user::FtpPwd]

|||

Hi,

Can you double check this syntax, please? It looks like that example doesn't match syntax provided!

I have tried several combinations of this parameters but neither didn't work! Did you get solved this problem? What else need to be set to get this concept working?

I can't beleive that MS didn't publish standard solution on such a genuine common requirement? Again!!!

Thanks Forward

Sladjan

|||

clovernet wrote:

Hi,

Try to set up a variable and set its value to the Connection expression in the FTP Task.

=> right click on the FTP Connection Manager and then select edit. Add a new expression for Connection and set it to the variable you have set up to store this value.This variable can be changed at runtime using Package Configurations.

Expression - ConnectionString -

"Server IP: Port.loginAccount.loginPWD"

EX: "192.168.1.1:21"+ @.[user::FtpAcct]+"."+ @.[user::FtpPwd]

Example should be "192.168.1.1:21." + @.[user::FtpAcct]+"."+ @.[user::FtpPwd] (it's missing the period after the port)

I've used the above and it works great. I would have NEVER figured this out without someone posting (THANK YOU CLOVER!!!)... Actually got all variables from a table through an SQL task that reads a view of FTP Info and directories/files to ftp. Since we FTP from multiple servers and multiple files/remote directories, we just put the FTP Task in a For Each loop. Did the concatenation for the ConnectionString in the FTP Connection manager as clovernet suggested @.user::varFTPIPAddress] + ":21." + @.[user::varFTPUser]+"."+ @.[user::varFtpPwd]

My issue is that on the FTP task, if I pass it "\directory\subdirectory\filename.ext" for the remote path (from a variable), I get an error message that the remote path doesn't start with a "/". When I reversed the slashes, it worked fine.... Why can the local/destination path have back slashes ("\"), but the remote/source path must have forward slashes? What the heck!!!

|||

I can't get the connection string to work. I can use a script task to use the variables to perform FTP operations but the only way I can set the password in a connection is via the config. It gives the error "Password not available" whenever I try to set it - that's in an expression or script setting the configuration string (as above) or in a script task setting the serverpassword. I'm guessing it's because it tries to read the value before setting it. Anyone know a way around this?

I need the password in a variable for the script tasks for thnigs that can't be done with an ftp task but the mget is easier in the ftp task. At the moment it requires two config entries for the same value.

|||

Dan,

I have tried a several combination of that example (including a period you are suggesting) but didn't get it working. It has to be sometjing else on the configuration to prevent pasing of the connection string on a same manner as you and Clover were suggesting. Thanks guys for your contributions, anyway.

Dan, try to use "/" for source and target destinations, both. Windows is able to handle both of them and you would not have a problem on ftp server and would not bring you confusion.

-

Nigel, here is what I have done and got it working by using package variables and VB.NET script task. It is more/less around few ideas sugested above:

Firstly I declared the set of variables for each of the relevant ftp parameters. Than prior FTP task I set following script task passing all of those variables as parameters.

Public Sub Main()

Dim ftpConnectionManager As ConnectionManager

ftpConnectionManager = Dts.Connections("FTP Connection Manager")

Dts.Connections("FTP Connection Manager").Properties("ServerName").SetValue(ftpConnectionManager, Dts.Variables("FtpServer").Value)

Dts.Connections("FTP Connection Manager").Properties("ServerPort").SetValue(ftpConnectionManager, Dts.Variables("FtpPort").Value)

Dts.Connections("FTP Connection Manager").Properties("ServerUserName").SetValue(ftpConnectionManager, Dts.Variables("FtpUser").Value)

Dts.Connections("FTP Connection Manager").Properties("ServerPassword").SetValue(ftpConnectionManager, Dts.Variables("FtpPassword").Value)

Dts.TaskResult = Dts.Results.Success

End Sub

Than remove values from the all non mandatory fields on FTP connection manager and disable validation.

On FTP task itself I parametrized destination folder (by using "/" inside the string) and source file connection.

All together, for each ftp server and each registered file I got FTP running in a loop sending each file on different designated server. And it works!

Sladjan

sql

FTP Connection Manager: Set FTP password using a variable

Hi,

I want to setup an FTP task that is portable in the sense that all it's connection parameters are stored in variables.

I can create expressions for properties ServerName and ServerUserName but not the ServerUserpassword. Is there an property that I missed, there seems to be properties for everything else except the key piece of info, the password.

I could create a script component using the FtpClientConnection method as a last resort but would rather not.

Any ideas?

Thanks

Ignore this thread, I wasn't thinking straight last night. I can use a config file to dynamically set the password.

Thanks|||I am trying to have the package load the password for an ftp site from a configuration file like you did. I cannot get it to work. How did you get it to work? Because it is sensitive information it does not get saved to the configuration file. I tried setting the package protection level to 'EncryptSensitiveWithPassword'. What did you use for the package protection level? Where are you storing you configuration file: SqlServer table or file system?|||

ProtectionLevel does not have any effect if the password is stored in a configuration file.

The password does not get stored in the configuration file by SSIS as this was considered a security risk. You have to add it there yourself. That way you, not the software, are accountable for storing it there.

-Jamie

|||

Jamie,

Thanks. As usual your answer was spot on. Cheers.

|||I'm a newbie at SSIS. I still don't understand from this thread, how to set the password. I have a list of ip/user/pass values in a table. How can I set the password on the connection manager dynamically?

Thanks in advance!
|||

Same Problem here. It looks like a password can be set only indirectly by setting the full ConnectionString. For example the following script

Public Sub Main()

Dim conn As ConnectionManager = Dts.Connections("testConn")
conn.ConnectionString="Data Source=MySQLServer;User ID=sa;Password=test;Initial Catalog=TestDb;Provider=SQLNCLI.1;"

Dts.TaskResult = Dts.Results.Success

End Sub

can modify an existing SQL Server Connection including the password. Note the password is removed immediatly from the string after setting it this way, but it seems it is still stored internally.

In an analogous way it should be possible to modify an existing FTP Connection. Sadly, I don't know the syntax for that type of connection.

MsgBox'ing the ConnectionString for an FTP Connection looks like 168.192.1.2:21 and does not even include the ServerUserName.

|||

Here is c# example code for this issue.

{
......
.....
string userName = "your username of the ftp";
string password = "Your password of the ftp";

etlPackage.Connections["FTP Connection Manager"].ConnectionString =
"Data Source=MySQLServer;User ID=sa;Password=test;Initial Catalog=TestDbCatalog=TestDb;" <-- keep in mind no "Provider"
object ftpConnectionManager = (object)etlPackage.Connections["FTP Connection Manager"];
etlPackage.Connections["FTP Connection Manager"].Properties["ServerUserName"].SetValue(ftpConnectionManager, userName);
etlPackage.Connections["FTP Connection Manager"].Properties["ServerPassword"].SetValue(ftpConnectionManager, password);
.......
.......
}

Then it will work.
If you need more information, let me know.
Pls,,, keep in mind, if you include "Provider" and "Auto Translate" info items within the connection string, you will get error.

|||Many thanks. I got the message "cast to object and then use SetValue" und will try it at the next opportunity.|||

Thanks for this thread, it has helped a lot.

I set the password in the config file manually as suggested, but now I get this error: The password was not allowed.

What is causing this and how do I fix it?

Thanks for your help.

Randy

|||

Hi,

Try to set up a variable and set its value to the Connection expression in the FTP Task.
=> right click on the FTP Connection Manager and then select edit. Add a new expression for Connection and set it to the variable you have set up to store this value.This variable can be changed at runtime using Package Configurations.

Expression - ConnectionString -

"Server IP: Port.loginAccount.loginPWD"

EX: "192.168.1.1:21"+ @.[user::FtpAcct]+"."+ @.[user::FtpPwd]

|||

Hi,

Can you double check this syntax, please? It looks like that example doesn't match syntax provided!

I have tried several combinations of this parameters but neither didn't work! Did you get solved this problem? What else need to be set to get this concept working?

I can't beleive that MS didn't publish standard solution on such a genuine common requirement? Again!!!

Thanks Forward

Sladjan

|||

clovernet wrote:

Hi,

Try to set up a variable and set its value to the Connection expression in the FTP Task.

=> right click on the FTP Connection Manager and then select edit. Add a new expression for Connection and set it to the variable you have set up to store this value.This variable can be changed at runtime using Package Configurations.

Expression - ConnectionString -

"Server IP: Port.loginAccount.loginPWD"

EX: "192.168.1.1:21"+ @.[user::FtpAcct]+"."+ @.[user::FtpPwd]

Example should be "192.168.1.1:21." + @.[user::FtpAcct]+"."+ @.[user::FtpPwd] (it's missing the period after the port)

I've used the above and it works great. I would have NEVER figured this out without someone posting (THANK YOU CLOVER!!!)... Actually got all variables from a table through an SQL task that reads a view of FTP Info and directories/files to ftp. Since we FTP from multiple servers and multiple files/remote directories, we just put the FTP Task in a For Each loop. Did the concatenation for the ConnectionString in the FTP Connection manager as clovernet suggested @.user::varFTPIPAddress] + ":21." + @.[user::varFTPUser]+"."+ @.[user::varFtpPwd]

My issue is that on the FTP task, if I pass it "\directory\subdirectory\filename.ext" for the remote path (from a variable), I get an error message that the remote path doesn't start with a "/". When I reversed the slashes, it worked fine.... Why can the local/destination path have back slashes ("\"), but the remote/source path must have forward slashes? What the heck!!!

|||

I can't get the connection string to work. I can use a script task to use the variables to perform FTP operations but the only way I can set the password in a connection is via the config. It gives the error "Password not available" whenever I try to set it - that's in an expression or script setting the configuration string (as above) or in a script task setting the serverpassword. I'm guessing it's because it tries to read the value before setting it. Anyone know a way around this?

I need the password in a variable for the script tasks for thnigs that can't be done with an ftp task but the mget is easier in the ftp task. At the moment it requires two config entries for the same value.

|||

Dan,

I have tried a several combination of that example (including a period you are suggesting) but didn't get it working. It has to be sometjing else on the configuration to prevent pasing of the connection string on a same manner as you and Clover were suggesting. Thanks guys for your contributions, anyway.

Dan, try to use "/" for source and target destinations, both. Windows is able to handle both of them and you would not have a problem on ftp server and would not bring you confusion.

-

Nigel, here is what I have done and got it working by using package variables and VB.NET script task. It is more/less around few ideas sugested above:

Firstly I declared the set of variables for each of the relevant ftp parameters. Than prior FTP task I set following script task passing all of those variables as parameters.

Public Sub Main()

Dim ftpConnectionManager As ConnectionManager

ftpConnectionManager = Dts.Connections("FTP Connection Manager")

Dts.Connections("FTP Connection Manager").Properties("ServerName").SetValue(ftpConnectionManager, Dts.Variables("FtpServer").Value)

Dts.Connections("FTP Connection Manager").Properties("ServerPort").SetValue(ftpConnectionManager, Dts.Variables("FtpPort").Value)

Dts.Connections("FTP Connection Manager").Properties("ServerUserName").SetValue(ftpConnectionManager, Dts.Variables("FtpUser").Value)

Dts.Connections("FTP Connection Manager").Properties("ServerPassword").SetValue(ftpConnectionManager, Dts.Variables("FtpPassword").Value)

Dts.TaskResult = Dts.Results.Success

End Sub

Than remove values from the all non mandatory fields on FTP connection manager and disable validation.

On FTP task itself I parametrized destination folder (by using "/" inside the string) and source file connection.

All together, for each ftp server and each registered file I got FTP running in a loop sending each file on different designated server. And it works!

Sladjan

FTP Connection Manager: Set FTP password using a variable

Hi,

I want to setup an FTP task that is portable in the sense that all it's connection parameters are stored in variables.

I can create expressions for properties ServerName and ServerUserName but not the ServerUserpassword. Is there an property that I missed, there seems to be properties for everything else except the key piece of info, the password.

I could create a script component using the FtpClientConnection method as a last resort but would rather not.

Any ideas?

Thanks

Ignore this thread, I wasn't thinking straight last night. I can use a config file to dynamically set the password.

Thanks|||I am trying to have the package load the password for an ftp site from a configuration file like you did. I cannot get it to work. How did you get it to work? Because it is sensitive information it does not get saved to the configuration file. I tried setting the package protection level to 'EncryptSensitiveWithPassword'. What did you use for the package protection level? Where are you storing you configuration file: SqlServer table or file system?|||

ProtectionLevel does not have any effect if the password is stored in a configuration file.

The password does not get stored in the configuration file by SSIS as this was considered a security risk. You have to add it there yourself. That way you, not the software, are accountable for storing it there.

-Jamie

|||

Jamie,

Thanks. As usual your answer was spot on. Cheers.

|||I'm a newbie at SSIS. I still don't understand from this thread, how to set the password. I have a list of ip/user/pass values in a table. How can I set the password on the connection manager dynamically?

Thanks in advance!|||

Same Problem here. It looks like a password can be set only indirectly by setting the full ConnectionString. For example the following script

Public Sub Main()

Dim conn As ConnectionManager = Dts.Connections("testConn")
conn.ConnectionString="Data Source=MySQLServer;User ID=sa;Password=test;Initial Catalog=TestDb;Provider=SQLNCLI.1;"

Dts.TaskResult = Dts.Results.Success

End Sub

can modify an existing SQL Server Connection including the password. Note the password is removed immediatly from the string after setting it this way, but it seems it is still stored internally.

In an analogous way it should be possible to modify an existing FTP Connection. Sadly, I don't know the syntax for that type of connection.

MsgBox'ing the ConnectionString for an FTP Connection looks like 168.192.1.2:21 and does not even include the ServerUserName.

|||

Here is c# example code for this issue.

{
......
.....
string userName = "your username of the ftp";
string password = "Your password of the ftp";

etlPackage.Connections["FTP Connection Manager"].ConnectionString =
"Data Source=MySQLServer;User ID=sa;Password=test;Initial Catalog=TestDbCatalog=TestDb;" <-- keep in mind no "Provider"
object ftpConnectionManager = (object)etlPackage.Connections["FTP Connection Manager"];
etlPackage.Connections["FTP Connection Manager"].Properties["ServerUserName"].SetValue(ftpConnectionManager, userName);
etlPackage.Connections["FTP Connection Manager"].Properties["ServerPassword"].SetValue(ftpConnectionManager, password);
.......
.......
}

Then it will work.
If you need more information, let me know.
Pls,,, keep in mind, if you include "Provider" and "Auto Translate" info items within the connection string, you will get error.

|||Many thanks. I got the message "cast to object and then use SetValue" und will try it at the next opportunity.|||

Thanks for this thread, it has helped a lot.

I set the password in the config file manually as suggested, but now I get this error: The password was not allowed.

What is causing this and how do I fix it?

Thanks for your help.

Randy

|||

Hi,

Try to set up a variable and set its value to the Connection expression in the FTP Task.
=> right click on the FTP Connection Manager and then select edit. Add a new expression for Connection and set it to the variable you have set up to store this value.This variable can be changed at runtime using Package Configurations.

Expression - ConnectionString -

"Server IP: Port.loginAccount.loginPWD"

EX: "192.168.1.1:21"+ @.[user::FtpAcct]+"."+ @.[user::FtpPwd]

|||

Hi,

Can you double check this syntax, please? It looks like that example doesn't match syntax provided!

I have tried several combinations of this parameters but neither didn't work! Did you get solved this problem? What else need to be set to get this concept working?

I can't beleive that MS didn't publish standard solution on such a genuine common requirement? Again!!!

Thanks Forward

Sladjan

|||

clovernet wrote:

Hi,

Try to set up a variable and set its value to the Connection expression in the FTP Task.

=> right click on the FTP Connection Manager and then select edit. Add a new expression for Connection and set it to the variable you have set up to store this value.This variable can be changed at runtime using Package Configurations.

Expression - ConnectionString -

"Server IP: Port.loginAccount.loginPWD"

EX: "192.168.1.1:21"+ @.[user::FtpAcct]+"."+ @.[user::FtpPwd]

Example should be "192.168.1.1:21." + @.[user::FtpAcct]+"."+ @.[user::FtpPwd] (it's missing the period after the port)

I've used the above and it works great. I would have NEVER figured this out without someone posting (THANK YOU CLOVER!!!)... Actually got all variables from a table through an SQL task that reads a view of FTP Info and directories/files to ftp. Since we FTP from multiple servers and multiple files/remote directories, we just put the FTP Task in a For Each loop. Did the concatenation for the ConnectionString in the FTP Connection manager as clovernet suggested @.user::varFTPIPAddress] + ":21." + @.[user::varFTPUser]+"."+ @.[user::varFtpPwd]

My issue is that on the FTP task, if I pass it "\directory\subdirectory\filename.ext" for the remote path (from a variable), I get an error message that the remote path doesn't start with a "/". When I reversed the slashes, it worked fine.... Why can the local/destination path have back slashes ("\"), but the remote/source path must have forward slashes? What the heck!!!

|||

I can't get the connection string to work. I can use a script task to use the variables to perform FTP operations but the only way I can set the password in a connection is via the config. It gives the error "Password not available" whenever I try to set it - that's in an expression or script setting the configuration string (as above) or in a script task setting the serverpassword. I'm guessing it's because it tries to read the value before setting it. Anyone know a way around this?

I need the password in a variable for the script tasks for thnigs that can't be done with an ftp task but the mget is easier in the ftp task. At the moment it requires two config entries for the same value.

|||

Dan,

I have tried a several combination of that example (including a period you are suggesting) but didn't get it working. It has to be sometjing else on the configuration to prevent pasing of the connection string on a same manner as you and Clover were suggesting. Thanks guys for your contributions, anyway.

Dan, try to use "/" for source and target destinations, both. Windows is able to handle both of them and you would not have a problem on ftp server and would not bring you confusion.

-

Nigel, here is what I have done and got it working by using package variables and VB.NET script task. It is more/less around few ideas sugested above:

Firstly I declared the set of variables for each of the relevant ftp parameters. Than prior FTP task I set following script task passing all of those variables as parameters.

Public Sub Main()

Dim ftpConnectionManager As ConnectionManager

ftpConnectionManager = Dts.Connections("FTP Connection Manager")

Dts.Connections("FTP Connection Manager").Properties("ServerName").SetValue(ftpConnectionManager, Dts.Variables("FtpServer").Value)

Dts.Connections("FTP Connection Manager").Properties("ServerPort").SetValue(ftpConnectionManager, Dts.Variables("FtpPort").Value)

Dts.Connections("FTP Connection Manager").Properties("ServerUserName").SetValue(ftpConnectionManager, Dts.Variables("FtpUser").Value)

Dts.Connections("FTP Connection Manager").Properties("ServerPassword").SetValue(ftpConnectionManager, Dts.Variables("FtpPassword").Value)

Dts.TaskResult = Dts.Results.Success

End Sub

Than remove values from the all non mandatory fields on FTP connection manager and disable validation.

On FTP task itself I parametrized destination folder (by using "/" inside the string) and source file connection.

All together, for each ftp server and each registered file I got FTP running in a loop sending each file on different designated server. And it works!

Sladjan

FTP Connection Manager: Set FTP password using a variable

Hi,

I want to setup an FTP task that is portable in the sense that all it's connection parameters are stored in variables.

I can create expressions for properties ServerName and ServerUserName but not the ServerUserpassword. Is there an property that I missed, there seems to be properties for everything else except the key piece of info, the password.

I could create a script component using the FtpClientConnection method as a last resort but would rather not.

Any ideas?

Thanks

Ignore this thread, I wasn't thinking straight last night. I can use a config file to dynamically set the password.

Thanks|||I am trying to have the package load the password for an ftp site from a configuration file like you did. I cannot get it to work. How did you get it to work? Because it is sensitive information it does not get saved to the configuration file. I tried setting the package protection level to 'EncryptSensitiveWithPassword'. What did you use for the package protection level? Where are you storing you configuration file: SqlServer table or file system?|||

ProtectionLevel does not have any effect if the password is stored in a configuration file.

The password does not get stored in the configuration file by SSIS as this was considered a security risk. You have to add it there yourself. That way you, not the software, are accountable for storing it there.

-Jamie

|||

Jamie,

Thanks. As usual your answer was spot on. Cheers.

|||I'm a newbie at SSIS. I still don't understand from this thread, how to set the password. I have a list of ip/user/pass values in a table. How can I set the password on the connection manager dynamically?

Thanks in advance!|||

Same Problem here. It looks like a password can be set only indirectly by setting the full ConnectionString. For example the following script

Public Sub Main()

Dim conn As ConnectionManager = Dts.Connections("testConn")
conn.ConnectionString="Data Source=MySQLServer;User ID=sa;Password=test;Initial Catalog=TestDb;Provider=SQLNCLI.1;"

Dts.TaskResult = Dts.Results.Success

End Sub

can modify an existing SQL Server Connection including the password. Note the password is removed immediatly from the string after setting it this way, but it seems it is still stored internally.

In an analogous way it should be possible to modify an existing FTP Connection. Sadly, I don't know the syntax for that type of connection.

MsgBox'ing the ConnectionString for an FTP Connection looks like 168.192.1.2:21 and does not even include the ServerUserName.

|||

Here is c# example code for this issue.

{
......
.....
string userName = "your username of the ftp";
string password = "Your password of the ftp";

etlPackage.Connections["FTP Connection Manager"].ConnectionString =
"Data Source=MySQLServer;User ID=sa;Password=test;Initial Catalog=TestDbCatalog=TestDb;" <-- keep in mind no "Provider"
object ftpConnectionManager = (object)etlPackage.Connections["FTP Connection Manager"];
etlPackage.Connections["FTP Connection Manager"].Properties["ServerUserName"].SetValue(ftpConnectionManager, userName);
etlPackage.Connections["FTP Connection Manager"].Properties["ServerPassword"].SetValue(ftpConnectionManager, password);
.......
.......
}

Then it will work.
If you need more information, let me know.
Pls,,, keep in mind, if you include "Provider" and "Auto Translate" info items within the connection string, you will get error.

|||Many thanks. I got the message "cast to object and then use SetValue" und will try it at the next opportunity.|||

Thanks for this thread, it has helped a lot.

I set the password in the config file manually as suggested, but now I get this error: The password was not allowed.

What is causing this and how do I fix it?

Thanks for your help.

Randy

|||

Hi,

Try to set up a variable and set its value to the Connection expression in the FTP Task.
=> right click on the FTP Connection Manager and then select edit. Add a new expression for Connection and set it to the variable you have set up to store this value.This variable can be changed at runtime using Package Configurations.

Expression - ConnectionString -

"Server IP: Port.loginAccount.loginPWD"

EX: "192.168.1.1:21"+ @.[user::FtpAcct]+"."+ @.[user::FtpPwd]

|||

Hi,

Can you double check this syntax, please? It looks like that example doesn't match syntax provided!

I have tried several combinations of this parameters but neither didn't work! Did you get solved this problem? What else need to be set to get this concept working?

I can't beleive that MS didn't publish standard solution on such a genuine common requirement? Again!!!

Thanks Forward

Sladjan

|||

clovernet wrote:

Hi,

Try to set up a variable and set its value to the Connection expression in the FTP Task.

=> right click on the FTP Connection Manager and then select edit. Add a new expression for Connection and set it to the variable you have set up to store this value.This variable can be changed at runtime using Package Configurations.

Expression - ConnectionString -

"Server IP: Port.loginAccount.loginPWD"

EX: "192.168.1.1:21"+ @.[user::FtpAcct]+"."+ @.[user::FtpPwd]

Example should be "192.168.1.1:21." + @.[user::FtpAcct]+"."+ @.[user::FtpPwd] (it's missing the period after the port)

I've used the above and it works great. I would have NEVER figured this out without someone posting (THANK YOU CLOVER!!!)... Actually got all variables from a table through an SQL task that reads a view of FTP Info and directories/files to ftp. Since we FTP from multiple servers and multiple files/remote directories, we just put the FTP Task in a For Each loop. Did the concatenation for the ConnectionString in the FTP Connection manager as clovernet suggested @.user::varFTPIPAddress] + ":21." + @.[user::varFTPUser]+"."+ @.[user::varFtpPwd]

My issue is that on the FTP task, if I pass it "\directory\subdirectory\filename.ext" for the remote path (from a variable), I get an error message that the remote path doesn't start with a "/". When I reversed the slashes, it worked fine.... Why can the local/destination path have back slashes ("\"), but the remote/source path must have forward slashes? What the heck!!!

|||

I can't get the connection string to work. I can use a script task to use the variables to perform FTP operations but the only way I can set the password in a connection is via the config. It gives the error "Password not available" whenever I try to set it - that's in an expression or script setting the configuration string (as above) or in a script task setting the serverpassword. I'm guessing it's because it tries to read the value before setting it. Anyone know a way around this?

I need the password in a variable for the script tasks for thnigs that can't be done with an ftp task but the mget is easier in the ftp task. At the moment it requires two config entries for the same value.

|||

Dan,

I have tried a several combination of that example (including a period you are suggesting) but didn't get it working. It has to be sometjing else on the configuration to prevent pasing of the connection string on a same manner as you and Clover were suggesting. Thanks guys for your contributions, anyway.

Dan, try to use "/" for source and target destinations, both. Windows is able to handle both of them and you would not have a problem on ftp server and would not bring you confusion.

-

Nigel, here is what I have done and got it working by using package variables and VB.NET script task. It is more/less around few ideas sugested above:

Firstly I declared the set of variables for each of the relevant ftp parameters. Than prior FTP task I set following script task passing all of those variables as parameters.

Public Sub Main()

Dim ftpConnectionManager As ConnectionManager

ftpConnectionManager = Dts.Connections("FTP Connection Manager")

Dts.Connections("FTP Connection Manager").Properties("ServerName").SetValue(ftpConnectionManager, Dts.Variables("FtpServer").Value)

Dts.Connections("FTP Connection Manager").Properties("ServerPort").SetValue(ftpConnectionManager, Dts.Variables("FtpPort").Value)

Dts.Connections("FTP Connection Manager").Properties("ServerUserName").SetValue(ftpConnectionManager, Dts.Variables("FtpUser").Value)

Dts.Connections("FTP Connection Manager").Properties("ServerPassword").SetValue(ftpConnectionManager, Dts.Variables("FtpPassword").Value)

Dts.TaskResult = Dts.Results.Success

End Sub

Than remove values from the all non mandatory fields on FTP connection manager and disable validation.

On FTP task itself I parametrized destination folder (by using "/" inside the string) and source file connection.

All together, for each ftp server and each registered file I got FTP running in a loop sending each file on different designated server. And it works!

Sladjan