Dynamic password in FTP task in SSIS ?
I can set almost all properties of FTP task and FTP connection manager using expressions option. In that option, I don't see that I can set FTP PASSWORD using a variable. How do I set the password dynamically ?
Thanks.
There are few options
1. Set password via configuration. In configuration you can identify Password property of FTP connection manager as an item and set a value through it
2. You can set it indirectly via connection string
Just create a variable to hold connection string variable for FTP connection manager and make EvaluateAsExpression as true for it. Then set following as its value
@[User::ServerName] + (DTW_WSTR,1) ":" + @[User::PortNumber] + (DTW_WSTR,1) "." + @[User::UserName] + (DTW_WSTR,1) "." +
@[User::Password]
Where ServerName,PortNumber,UserName and Password are variables you created inside SSIS to pass the value. You can also add them to configuration to pass the values from outside.
If you dont want to make all part dynamic pass static values for ones you dont need (for example 21 for port etc)
3. Use a script task to set value for FTP connection manager properties
use code like below
Public Sub Main()
Dim FTPConnectionManager As ConnectionManager
'Set variable to an existing connection manager
FTPConnectionManager = Dts.Connections("Your FTP connection Manager name")
FTPConnectionManager.Properties("ServerName").SetValue(FTPConnectionManager, Dts.Variables("ServerName").Value)
FTPConnectionManager.Properties("ServerPort").SetValue(FTPConnectionManager, Dts.Variables("PortNumber").Value)
FTPConnectionManager.Properties("ServerUserName").SetValue(FTPConnectionManager, Dts.Variables("UserName").Value)
FTPConnectionManager.Properties("ServerPassword").SetValue(FTPConnectionManager, Dts.Variables("Password").Value)
Dts.TaskResult = Dts.Results.Success
End Sub
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs
Similar Messages
-
SSIS 2008 - Sending file with dynamic name using FTP task
Hi - Thanks for taking a look - (I'm very new to SSIS.)
I'm trying to create an SSIS 2008 package that does the following:
1) Execute a stored procedure on SQL.
2) Download the results as a CSV file to a 'local' location. The file name is set using a variable ("User::LocalFilePath") dynamically based on the current time:
@[User::LocalFilePath] + "GreatReportName_" + "_" +(DT_STR,4,1252) DatePart("yyyy",getdate()) + Right("0" + (DT_STR,4,1252) DatePart("m",getdate()),2) + "_" + Right("0"
+ (DT_STR,4,1252) DatePart("d",getdate()),2) + "_" + Right("0" + (DT_STR,4,1252) DatePart("hh",getdate()),2) + "_" + Right("0" + (DT_STR,4,1252) DatePart("mi",getdate()),2)
+ "_" + Right("0" + (DT_STR,4,1252) DatePart("ss",getdate()),2) + ".csv"
3) Transfer the CSV file to an FTP site.
4) Delete the CSV file from the 'local' location.
I've been able to do steps 1 and 2 so far. However when trying the move the newly created file to the FTP site I get the error:
"Error: 0xC002917C at Send to FTP, FTP Task: The variable "User::LocalFilePath" doesn't contain file path(s)."
(When I set the "IsLocalPathVariable" to "False" and use a file previously created the file is correctly transferred to the FTP site. This proves that the FTP details are correct and that the "RemotePathVariabe" is working
correctly.)
I have set the variable ("User::LocalFilePath") to "EvaluateAsExpression" in the variable properties.
Can anyone help?
Many Thanks,
UnoTHi Vaibhav,
Thanks for your response. I set the "DelayValidation" to "True". However
that didn't make any difference.
I added in all the breakpoints, but it didn't give any results (I may be doing this incorrectly?):
Any other suggestions?
Thanks,
UnoT -
SSIS FTP task - folder is not showing in the development environment
I need to automate an excelsheet transformation process. for that I need to take the file from a ftp location. I can see all folders and the required folder "xyz" in the ftp location when we browse it within the SSIS 2005 FTP task from my laptop.
I also can see all the folders except "xyz" folders when I broswed it within the FTP task in ssis 2005 in the development environment same behaviour in the production.
This is not a User name and Password issue since we can clearly see rest of the folders in production , dev except the required folder.
This can not be a permission issue since i managed to locate the "xyz" folder within the dev and prod servers using winscp.
The follwoing are the .net versions in my laptop and in the Dev and Prod environments.
VS 2005 Version in my laptop
-Is 8.0.50727.42(Premier Partner ENU) .net framework is 4.5.1
VS 2005 Version in development server
-Is 8.0.50728 (Premier Partner ENU) .net framework is 2.0 Service pack 2.0
Could this be a version issue???
thanksSo is it not seen via both, WinSCP and SSIS? It is a security issue regardless IMO.
Something is different in how the "folder browsing" performed between the environments.
E.g. perhaps you log in to the Win 2003 machine via some kind of terminal connection or there is a different policy file applied to it than when you are on your Win 8.
Arthur My Blog -
Hello,
we have SQL Server 2012. I created FTP task in SSIS.
On the connection manager when I try "Test connection" it returns "succeded".
But when I run DTS package I get an error "Error: 0xC002918F at FTP Task, FTP Task: Unable to connect to FTP server using "FTP Connection Manager"."
It seems that SSIS doesn't save the password.
Package level is: Don't Save Sensitive. The password contains "A" and "a". Could there be a problem. Then how to solve it?Did you add password as a configurable item inside?
See this example
http://blogs.msdn.com/b/runeetv/archive/2009/12/22/ssis-package-using-sql-authentication-and-dontsavesensitive-as-protectionlevel.aspx
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Can SSIS be used to pick up files dynamically from an FTP folder?
I get 4 files dumped into an FTP folder each day. Each comes in with a date, in this format: '20140320' & the filename, which is always the same convention for these four files. Can I run SSIS on a daily basis, like at 9AM, to scan through
the files in the folder, and import the ones that were dropped in today (today's files always have yesterday's date).
Thanks!!
Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.Hi,
You can check the below Link.
http://microsoft-ssis.blogspot.com/2011/08/foreach-ftp-file-enumerator.html
Also I would suggest create 4 ftp tasks for each files and define 4 expressions based on the expression below. Give then each file name
with the expression that is defined.
“Filename#####1” + (DT_STR,4,1252) DatePart("yyyy",getdate()) + Right("0" + (DT_STR,4,1252) DatePart("m",getdate()),2)
+ Right("0" + (DT_STR,4,1252) DatePart("d",getdate()),2) + ".csv"
“Filename#####2” + (DT_STR,4,1252) DatePart("yyyy",getdate()) + Right("0" + (DT_STR,4,1252) DatePart("m",getdate()),2)
+ Right("0" + (DT_STR,4,1252) DatePart("d",getdate()),2) + ".csv"
“Filename#####3” + (DT_STR,4,1252) DatePart("yyyy",getdate()) + Right("0" + (DT_STR,4,1252) DatePart("m",getdate()),2)
+ Right("0" + (DT_STR,4,1252) DatePart("d",getdate()),2) + ".csv"
“Filename#####4” + (DT_STR,4,1252) DatePart("yyyy",getdate()) + Right("0" + (DT_STR,4,1252) DatePart("m",getdate()),2)
+ Right("0" + (DT_STR,4,1252) DatePart("d",getdate()),2) + ".csv"
Or whatever the file format is, I selected .csv
Regards, PS -
SSIS FTP Task Variable Remote Path invalid
I am working on the SSIS FTP Task that transfer file from one FTP server to local location, rename the file name, and finally transfer the renamed file to another FTP server. So I defined 2 FTP tasks.
For the FTP file receive operation, I need the remote path to be updated by a script and pass to the user define variable. So I set TRUE to IsRemotePathVariable. In the RemoteVariable, I set User::FTPSourcePath where the variable is set in the script with "/DMFTP/filename1.jpg"
For the FTP file send operation, I set TRUE to IsRemotePathVariable. In the RemoteVariable, I set User::FTPDestPath where the variable is set in the script with "/DestFTP/"
After all the setting, the FTP Task box show me the error as "Variable "FTPSourcePath" doesn't start with "/". Another FTP box show me "Variable "FTPDestPath" doesn't start with "/"
Can anyone help me on this problem?? Thanks.Enzoe,
I had the same issue going against the Unix FTP site to attempt to delete files and so I wrote a little function in C# library that I use from a script task to accomplish what I want. You could probably do this inline to a script task but it would not be reusable.
public static void FtpDeleteFiles(ScriptObjectModel dts, string connectionName, string[] remoteFiles)
ConnectionManager mgr = dts.Connections[connectionName];
FtpClientConnection conn = new FtpClientConnection(mgr.AcquireConnection(null));
if (conn != null)
conn.Connect();
try {
conn.DeleteFiles(remoteFiles);
} finally {
conn.Close();
This allows me to create the FTP connection and configure it through the normal SSIS methods and then invoke the FTP process from those connections myself. There are some area's to improve on so that if the connection is NULL an exception is thrown or logged and maybe return a boolean.
Pretty simple...
Fred -
FTP task runs fine from SSIS Package Store, always times out in scheduled job
SQL Server 2012
VS 2010 SQL Server data tools
FTP Connection Manager
- port 21, chunk size 1kb, passive mode=false, saved plain text pw
Downloads 1 csv file to local directory on SQL Server box
This always works when run from the package. And always gives a timeout error when scheduled.
Message
Microsoft (R) SQL Server Execute Package Utility
Version 11.0.2100.60 for 64-bit
Started: 11:04:59 AM
Error: 2014-03-27 11:05:31.12
Code: 0xC001602A
Source: xxx Connection manager "FTP Acme1"
Description: An error occurred in the requested FTP operation. Detailed error description: The operation timed out
End Error
Error: 2014-03-27 11:05:31.14
Code: 0xC002F304
Source: Acme FTP Task
Description: An error occurred with the following error message: "An error occurred in the requested FTP operation. Detailed error description: The operation timed out".
End Error
DTExec: The package execution returned DTSER_FAILURE (1).
Started: 11:04:59 AM
Finished: 11:05:31 AM
Elapsed: 31.949 seconds
SQL Server Agent is set to Logon As my domain account, and in the package history it says "logged on as " my account.
Any suggestions? Thank youYou're right, Arthur. Earlier when I tried running the package with dtexecui it did popup a Win7 firewall warning. Agreed with prompt to allow "SQL Server 2008 Integration Services Package Execution Utility" and it added C:\program
files (x86)\microsoft sql server\110\tools\binn\managementstudio\dtexecui.exe, to allowed programs. No problem with dtexec after that.
Do you know of any other firewall exceptions that would be good to try? Thanks!
Yeah, this pop up resulted in the timeout because it was hidden but awaiting acknowledgement.
The other thing off the top of my head would be the FTP port 21 if TCP is used.
Arthur My Blog -
How to use a key file in the FTP Task using and SSL connection
In the past I have used this code to set the FTP pass word in an FTP component task in SSIS.
Does anyone know how to use a Key file in an SSL connection to download a file from an FTP site? If not can you tell me where I can get the C# code examples to learn how to create a script task or if there is another way in SSIS to download large files
from an SSL FTP site? Thank you for any help offered.
public void Main()
ConnectionManager FTPConn;
FTPConn = Dts.Connections["FTPServer"];
FTPConn.Properties["ServerPassword"].SetValue(FTPConn, Dts.Variables["FTPPassword"].Value);
Dts.TaskResult = (int)ScriptResults.Success;
AntonioYou can use SFTP for this.
This is a way of implementing SFTP in SSIS using standard tasks
http://visakhm.blogspot.in/2012/12/implementing-dynamic-secure-ftp-process.html
also see
http://blog.goanywheremft.com/2011/10/20/sftp-ftps-secure-ftp-transfers/
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
What is causing this FTP task to fail?
I use the same FTP task to connect to a local ftp site but when I try to hit another one, I get these errors: The obvious stuff like connection string, ip address and password are set up correctly because my test connection works fine. I haven't packaged
this until it works interactively. Can someone point me in the right direction?
[Connection manager "FTP Connection Manager"] Error: An error occurred in the requested FTP operation. Detailed error description: 200 Type Binary
200 Port command received
425 Unable to open the data connection
Warning: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The Execution method succeeded, but the number of errors raised (1) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified
in MaximumErrorCount. Change the MaximumErrorCount or fix the errors.I am using VS2008 and trying this in debug mode first before I package it. When I ran the package through the scheduler, I got this more detailed error which seems to point to the connection:
Executed as user: CAMPUS\UCCTD10_SQL. Microsoft (R) SQL Server Execute Package Utility Version 10.50.2500.0 for 64-bit Copyright (C) Microsoft Corporation 2010. All rights reserved. Started: 10:55:47 AM Error: 2014-02-20
10:57:00.36 Code: 0xC001602A Source: Test_Adv_trac Connection manager "FTP Connection Manager" Description: An error occurred in the requested FTP operation. Detailed error description:
200 Type Binary 200 Port command received 425 Unable to open the data connection . End Error Error: 2014-02-20 10:57:00.37 Code: 0xC002918B Source: FTP Task FTP Task
Description: Unable to send files using "FTP Connection Manager". End Error DTExec: The package execution returned DTSER_FAILURE (1). Started: 10:55:47 AM Finished: 10:57:00 AM Elapsed: 73.274 seconds.
The package execution failed. The step failed.
My setup screen values are as follows:
Since I can't print the screen, I have all parameters set to false on the transfer screen.
Do I need to increase timeout or error values? -
I need to FTP-SSL. Can I use FTP Task do FTPS? and How?
Thank you.
newbiewe use SFTP.
By default SSIS FTP task doesnt support SFTP. But there are free clients like WinSCP which can invoked from SSIS
We use Execute Process Task for the same. The WinSCP client requires a script file where you pass the required commands (put,get etc) for transfer of files from and to server.
This is a blog I wrote on the same for setting filename etc dynamically to do SFTP
http://visakhm.blogspot.in/2012/12/implementing-dynamic-secure-ftp-process.html
http://winscp.net/eng/docs/guide_ssis
And this is a comparison between SFTP and FTPS and of both SFTP is easier to setup
http://blog.goanywheremft.com/2011/10/20/sftp-ftps-secure-ftp-transfers/
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
How to create dynamic connection string with variables using ssis.
Hello,
Can anyone let me know on how to create dynamic connection string with variables using ssis?
Any help would be appreciated.Hi vinay9738,
According to your description, you want to connect multiple database from multiple servers using dynamic connection.
If in this case, we can create a Table in our local database (whatever DB we want) and load all the connection strings. We can use Execute SQL Task to query all the connection strings and store the result-set in a variable of object type in SSIS package.
Then use ForEach Loop container to shred the content of the object variable and iterate through each of the connection strings. And then Place an Execute SQL task inside ForEach Loop container with the SQL statements we have to run in all the DB instances.
For more details, please refer to the following blog:
http://sql-developers.blogspot.kr/2010/07/dynamic-database-connection-using-ssis.html
If there are any other questions, please feel free to let me know.
Regards,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
I am trying to run a job which contains an SISS package and it runs Under SA ,I get an error for FTP task and when i ran in BIDS it is working fine.The error is below and could anyone please help me to solve the issue.I tried with package protection level
and still i am getting the same error.
Message
Executed as user: M****\Svc-****SQLAgent. Microsoft (R) SQL Server Execute Package Utility Version 10.50.6000.34 for 32-bit Copyright (C) Microsoft Corporation 2010. All rights reserved. Started: 2:30:01 PM Error: 2015-01-27
14:30:02.02 Code: 0xC0016016 Source: Description: Failed to decrypt protected XML node "DTS:Property" with error 0x8009000B "Key not valid for use in specified state.". You may not be authorized
to access this information. This error occurs when there is a cryptographic error. Verify that the correct key is available. End Error Error: 2015-01-27 14:30:02.14 Code: 0xC0016016 Source: Description:
Failed to decrypt protected XML node "DTS:Property" with error 0x8009000B "Key not valid for use in specified state.". You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that
the correct key is available. End Error Error: 2015-01-27 14:30:03.48 Code: 0xC001602A Source: SSISPackage Connection manager "FTP Connection Manager " Description: An error occurred in the requested
FTP operation. Detailed error description: The password was not allowed . End Error Error: 2015-01-27 14:30:03.48 Code: 0xC002918F Source: FTP Task Get Files FTP Task Description: Unable to connect
to FTP server using "FTP Connection Manager 1". End Error DTExec: The package execution returned DTSER_FAILURE (1). Started: 2:30:01 PM Finished: 2:30:03 PM Elapsed: 2.496 seconds. The package execution
failed. The step failed.Hi Mathew,
Based on the error message that “Description: Failed to decrypt protected XML node "DTS:Property" with error 0x8009000B "Key not valid for use in specified state.". You may not be authorized to access this information. This error occurs
when there is a cryptographic error. Verify that the correct key is available.", it seems that the issue is related to Protection Level Settings.
EncryptSensitiveWithUserKey means use a key that is based on the current user profile to encrypt only the values of sensitive properties in the package. Only the same user who uses the same profile can load the package. If a different user attempts to execute
the package, package execution fails. To fix this issue, please change this:
Package Proprties Window >ProtectionLevel -- Change that to EncryptSensitiveWithPassword PackagePassword -- enter password-> somepassword
Then on SQL Agent Job Step, go the Command Line Tab, manually edit command line with the command below:
/De[crypt] password
Reference:
Access Control for Sensitive Data in Packages
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
FTP Task not working properly on Azure VM
I am able to get connection when i press "Test Connection" inside the connetion manager.
However - when trying to browse the remote FTP server's directory inside the FTP task editor, I get the following error message:
"An error occured in the requested FTP operation. Detailed error description: 200 Type set to A. 500 Illegal PORT command . 500 LPRT not understood"
I should add that i am able to connect and browse the FTP server using the windows FTP command, so I assume it is related to the FTP task component in SSIS. I have tested this on a normal windows server - and there it works fine.
Any ideas what might be wrong ?
dakineSetup FTP connection in passive mode solve this problem:
Found at http://sqlserverrider.wordpress.com/2013/09/05/ftp-task-connection-error-unable-to-service-port-commands-500-lprt/
Arthur My Blog -
Hi,
We are deploying dataservices and in QA environment, the target database password changes once in 2 weeks. We dont want to update the password to the datastore everytime as it requires manual intervention and also some of the jobs may fail till the time we update the password.
Is there a way my datastore can have dynamic passwords and read them on the fly. I mean from a text file or so.
Appreciate for your help.
ThanksI have posted a possible way of doing this using al_engine for datastore password
http://www.forumtopics.com/busobj/viewtopic.php?t=150341
I need to check if you could do the same for other properties, you can try that, check the ATL of the Datastore and see what is the tag name of the FTP password and try adding that also in the input XML and see if it works -
Hi Experts,
I am trying to open .xlsx file in script task of SSIS 2005. I am using the 32-bit AccessDatabaseEngine driver with the Connection string as "Provider= Microsoft.ACE.OLEDB.12.0; Data Source=xlsx file path; Extended Properties="Excel 12.0 Xml;
HDR=YES"" in script task.
When we debug the VB script in Visual Studio 2005 and encounters the statement app.open() it throws the error "Couldn't find installable ISAM".
My SQL server version is 2005 SP2 DE
OS is Windows server 2003 EE SP2
Could anyone please let me know what is the resolution for this error?
Thanks and Regards,
AdeshHi Adesh,
First, make sure the package runs in 32-bit runtime mode (set Run64BitRuntime property to False) because you are using the 32-bit ACE OLE DB Provider. If it is not the case, the issue may occur due to the corrupted drivers or registry keys. You can try to
reinstall the 2007 Office System Driver: Data Connectivity Components as Arthur suggested.
Regards,
Mike Yin
TechNet Community Support
Maybe you are looking for
-
MD04 - Showing partial delivered sales order
Hi, We work with allocation run (AFS), and too many sales orders are not delivered with 100%, some itens are delivered with a partial quantity and others items are not delivered. Consider the example: Sales order 0000321654 Item: 0010 - Ordered: 100
-
Disable Schema check in Oracle Directory Server
How does one disable schema checking in Oracle Directory Server. I couldnt figure it out. This is easily done in openLDAP , netscape LDAP server. null
-
HP Pavilion dv7-4015ew secondary disc SSD and Recovery Manager
Dear Friends ! HP Pavilion dv7-4015ew + AMD 4 egs Phenom II N970 Quad-core 2,2 GHz + 8GB Ram I bought: - SSD GOODRam C40 128 GB - Cable connector: 23,5 cm long (netto - only cable) or 28,5 cm (brutto- all lenght). = Look fine, I can put it 1. We ha
-
Hi everyone. I recently made a factory reset on my N8-00 because wanted to free up the C:/ space after having problems in upgrading WhatsApp. The factory reset method used is *#7370#. After the factory reset, I have restored back files backed up earl
-
My ipad screen won't turn one way when I turn/bump my ipad (will do one side but not the other)