Parameterized Flat File Connection String - csv

I'm using a Script Task(VB) to get the complete file path for a specific csv file that I want to load in SQL Server table. In the Script Task I loop through the directory (based on certain conditions) and assign the file path to a writable package variable as:
Dts.Variables("User::strPFilePath").Value = Folder + "\" + File.Name
Now I have the complete CSV file path and I set this up by parameterizing the csv connection manager with the property expression ConnectionString using this variable to dynamically assign the connection string.
This works fine when I run the package in Visual Studio but when I deploy it to SQL Server under SSISDB folder I get the following error specifically at that script task:
Exception has been thrown by the target of an invocation
The Data Flow Task after the script task generates the following error:
Cannot open the datafile""
The second message to me implies that the file path is not being passed dynamically to the ConnectionManager for the CSV.
Any ideas on how I can fix this or deploy it properly?
Thanks

Related

SSIS SQL Agent job - Error: for each sub folder : The get enumerator method of the for each enumerator

I have a SSIS Package , which runs fine in Visual studio. The package uses a for each file loop and the variable points to a folder like this:
\\server\d$\foldername\subfolder\
When I deploy the package on SSMS, when I execute the package I get the following error:
Error 1: FLC - for each sub folder: Error: The GetEnumerator method of the ForEach enumerator has failed with error 0x80131509 "null" . This occurs when the for each enumerator cannot enumerate
Error 2: FLC - For each sub folder: Error The object in the variable "User: ProductFolderList" does not contain an enumerator.
Below is the code used:
string folder = Dts.Variables["User::varProcessingFolderLocation"].Value.ToString();
Dts.Variables["User::ProductFolderList"].Value = System.IO.Directory.GetDirectories(folder);
Dts.TaskResult = (int)ScriptResults.Success;
SSMS version is 2017, visual studio solution is built in 2016 and project configuration is VNext. I have verified the permissions of the folder and the ID with which I am running it has full control.
How to fix this? Thanks
[Code with Message box]
string folder = Dts.Variables["User::varProcessingFolderLocation"].Value.ToString();
MessageBox.Show(folder);
Dts.Variables["User::ProductFolderList"].Value = System.IO.Directory.GetDirectories(folder);
MessageBox.Show(Dts.Variables["User::ProductFolderList"].Value.ToString())

SSIS 2008 Execute Package Task Connection Expression not valid

In SSIS 2008 I am trying to configure a package to execute another package using the Execute Package Task. In the Execute Package Task Connection expression I am using a variable that contains the absolute path to the folder where the package I want to execute is located because as we all now relative paths don't work in SSIS. The expression evaluates to what looks to be the right path as can be seen in the screenshot below.
However when I try to execute the package I get the following error that it can't find the package:
I am very confused by this because the package path is correct. Any ideas?
I think you are setting the connection in the wrong place.
You need to set the connection string in the connection manager.
Example that I want to change the Package1.dtsx to execute Package2t.dtsx ..
Created Connection Manager "Package1.dtsx" that references a package in a folder called Package1.dtsx
Properties of Connection of Package1.dtsx in Connection Manager
Change ConnectionString in Connection Manager to execute Package2t.dtsx.
Try including double quotes since your file path string has spaces in it
"\"" + #[User::RootFolder] + "\\" + "ImportSessionAndSubsessions.dtsx\""

Unable to schedule an ssis package WHICH RETRIEVES data from MYSQL

I've created an SSIS PACKAGE on machine X to retrieve data from MYSQL DB Query from machine Y and write to an SQLSERVER Destination Table which is on machine Z(compulsions since I am unable to connect to mysql from Z and X is the only machine which has navicat).
The package runs to the T when run manually and I'm trying to schedule it on machine X for Z's DB .I've created the xml configuration file and placed it on Z since the process runs on Z's DB.and the job fails when executing as a scheduled Job.
I've added passwords to the config file as they don't save automatically.
I suppose it's due to different machines being used(Package on X running on Z's DB and config file on Z).
Here's the error:
Failed to open package file "D:\CSMS\SSIS\Random\Random\MySQlDBtoDWH11DataTransfer.dtsx" due to error 0x80070015 "The device is not ready." This happens when loading a package and the file cannot be opened or loaded correctly into the XML document. This can be the result of either providing an incorrect file name was specified when calling LoadPackage or the XML file was specified and has an incorrect format. End Error Could not load package "D:\CSMS\SSIS\Random\Random\MySQlDBtoDWH11DataTransfer.dtsx" because of error 0xC0011002. Description: Failed to open package file "D:\CSMS\SSIS\Random\Random\MySQlDBtoDWH11DataTransfer.dtsx" due to error 0x80070015 "The device is not ready." This happens when loading a package and the file cannot be opened or loaded correctly into the XML document. This can be the result of either providing an incorrect file name was specified when calling LoadPackage or the XML file was specified and has an incorrect format.
Unable to understand where I'm failing!
Are you using Direct configuration or using Indirect( in which your xml config file path is saved in Environmental variable?
IF you are using Direct configuration, you need to make sure your both machines have the same folder structure which is saved in package.
If you are using Environment variable to point to configuration file. Make sure you have changed the value of variable according to machines and folders where your configuration file is.
To close this question,I've scheduled it to run from a batch file and the process is running fine.

Error thrown by SSIS package : The input Web Services Description Language (WSDL) file is not valid

Im trying to connect to a web service using Web Service task. I have used the WsdlFile property to dynamically set the path of WSDL file.
The package executes fine on my local system. When I try to execute the same package on my TEST server ( via Active Batch scheduler), it fails with the following exception :
-1073548540,0x,An error occurred with the following error message: "Microsoft.SqlServer.Dts.Tasks.WebServiceTask.WebserviceTaskException: The input Web Services Description Language (WSDL) file is not valid.
I have placed the WSDL file in my TEST server location ( which is equal to the path set in WsdlFile property) and also have Delay Validation = True on WebService task in the package.
Kindly help on how can I resolve this issue.
In my experience this will only occur if the WSDL file is invalid (obviously!) or the SSIS package can't find the WSDL file. Ensure that your configuration exposes the WsdlFile property.
To do so, select SSIS > Package Configurations, and create or edit an existing configuration. Tick the WsdlFile property to expose it:
This will add a property to a configuration file. Ensure that the value of that is set to a full file path e.g. "D:\SSIS\WebService.wsdl"
Finally, once deployed, ensure that your SSIS package references the configuration file you've created.

Override SSIS configuration setting on command line?

I'm trying to run an SSIS package from the SQL Server Management Studio, and am having trouble overriding a configuration setting. In my case, it's the location of a flat file. The command I'm using is:
declare #returncode INT
exec #returncode = xp_cmdshell 'dtexec
/SQL "\ImportData"
/SERVER "myserver"
/CONNECTION "ImportData flatfile connection";"C:\files\ballot.dat"
/MAXCONCURRENT " -1 "
/CHECKPOINTING OFF /REPORTING E'
As you can see above, I'm trying to run this using c:\files\ballot.dat as the flat file in question. When doing so however, SSIS reverts to using the setting stored in its configuration file, which points to a different location (and ballot.dat file) on the hard drive.
Is there a way to override that when calling the package from the command line? Thanks for your suggestions.
What you can do is to add an SSIS Package configuration XML file. In this configuration you can specify all connection managers (just include the connection string). save this file as c:\otherconfig.xml or something like that. Edit the file, you should see your connection listed, and you can edit the connection string.
When running the package with dtexec you should be able to run it with that config file using /configuration.
Note also that there are lot of changes from 2005 to 2008 in how connections and package configurations are handled. See http://msdn.microsoft.com/en-us/library/bb500430.aspx for more details.
You need to set the *full" connection string, not just the file name...
/CONNECTION "ImportData flatfile connection";"Provider=...;Data Source=C:\files\ballot.dat"