SSIS relative flat file source path - sql-server

I'm building a package, that will be shared among other people in order to load some data and I'd like it to be dynamic as much as possible.
At the moment I'm struggling with relative path names in Flat File Connection Manager Editor.
Currently I have File Name set as .\Source\ComTrade\Import.csv and once I click preview, then I can see all of my records. Screenshots below:
However once I run my package it does not find my file and I get these error messages:
[Source - All imports in file [85]] Information: The processing of file ".\Source\ComTrade\Import.csv" has started.
[Source - All imports in file [85]] Warning: The system cannot find the path specified.
[Source - All imports in file [85]] Error: Cannot open the datafile ".\Source\ComTrade\Import.csv".
[SSIS.Pipeline] Error: Source - All imports in file failed the pre-execute phase and returned error code 0xC020200E.
How can I use such file naming conventions in SSIS?

Related

Run ssis package in agent job while both are on separate machines

I am trying to run ssis package through agent jobs. The packages and the sql server are on different machines.
When the agent job tries to run ssis package step the job fails with following error:
Executed as user: Domain\username. Microsoft (R) SQL
Server Execute Package Utility Version 13.0.5026.0 for 64-bit
Copyright (C) 2016 Microsoft. All rights reserved. Started:
1:42:42 AM Error: 2020-01-23 01:42:42.49 Code: 0xC0011007
Source: {07BB41B6-D0DF-4349-B9AE-498397D214D7} Description:
Unable to load the package as XML because of package does not have a
valid XML format. A specific XML parser error will be posted. End
Error Error: 2020-01-23 01:42:42.49 Code: 0xC0011002 Source:
{07BB41B6-D0DF-4349-B9AE-498397D214D7} Description: Failed to
open package file
"D:\ssis_packages\package.dtsx"
due to error 0x80070003 "The system cannot find the path specified.".
This occurs when loading a package and the file cannot be opened or
loaded correctly into the XML document. This can be the result of
specifying an incorrect file name when calling LoadPackage or the
specified XML file has an incorrect format. End Error Could not load
package
"D:\ssis_packages\package.dtsx"
because of error 0xC0011002. Description: Failed to open package file
"D:\ssis_packages\CoreLogic\CoreLogicSSIS\Real_Estate_Monthly.dtsx"
due to error 0x80070003 "The system cannot find the path specified.".
This occurs when loading a package and the file cannot be opened or
loaded correctly into the XML document. This can be the result of
specifying an incorrect file name when calling LoadPackage or the
specified XML file has an incorrect format. Source:
{07BB41B6-D0DF-4349-B9AE-498397D214D7} Started: 1:42:42 AM
Finished: 1:42:42 AM Elapsed: 0.047 seconds. The package could not
be found. The step failed.
I need some suggestion as what is the best way to run ssis package when sql server and packages are on different machines.
There can be below defined reasons and solutions.
1. The error says it cannot find the package. Just double-check if this is the correct path for your package:
D:\ssis_packages\CoreLogic\CoreLogicSSIS\Real_Estate_Monthly.dtsx
2. It looks like a local path, so if indeed your package is on the D: Drive of another server make sure to add the server name in front of the path:
//server-name/ d$/
ssis_packages\CoreLogic\CoreLogicSSIS\Real_Estate_Monthly.dtsx
3. Grant the account running your SQL Agent job (I am guessing it's the SQL Agent account, but you should double-check that) access rights to the folder where your SSIS package is stored.
4. If the above did not solve the issue, also check if the SSIS package and your SSIS installation on the server where you are running it are the same. Running a 32bit SSIS package on a 64-bit system/SSIS will result in a similar error message.

Jenkins: File not found exception

I am trying to load a file from a repository I checked out. I am getting this error:
new File( iFilePath )
Err: Build failed with Error: java.io.FileNotFoundException: Y:\Jenkins\workspace\TestBuilds\Matlab\m\Contents.m (The system cannot find the path specified)
This is explained because Jenkins try to look for the file on the master. While the file is actually located on the slave agent.
Any way to get around this ?
Check out this answer: https://stackoverflow.com/a/42018578/3486967
I don't think you can use the File class on anything but the Jenkins master; try using the FilePath class

SSIS Visual Studio 2012 XML File Source says file not found

I have a folder with multiple xml files and need to loop through it and load xml data into Database. But for the XML Source i added a path to the xml files but it throws error saying
Package Validation Error
ADDITIONAL INFORMATION:
Error at GTN Load [GTN XML [43]]: The file "C:\SSIS\XML Files" was not found. Please verify the file path and try again.
Error at GTN Load [SSIS.Pipeline]: "XML" failed validation and returned validation status "VS_ISBROKEN".
Error at GTN Load [SSIS.Pipeline]: One or more component failed validation.
Error at GTN Load: There were errors during task validation (Microsoft.DataTransformationServices.VsIntegration)
I actually found the same error in stackoverflow (Using a variable to process all *.xml files using SSIS) and tried the solution in SSIS 2012 and it worked after that.
Change the VaidateExternalMetadata to false

Failed to open package file due to error 0x800070035

Full error message:
Could not load package "\\File.dtsx" because of error 0xC0011002.
Description: Failed to open package file "\\File" due to error 0x80070035 "The network path was not found.". This occurs when loading a package and the file cannot be opened or loaded correctly into the XML document. This can be the result of specifying an incorrect file name when calling LoadPackage or the specified XML file has an incorrect format.
This is a really strange issue. We have an SSIS package which is called via dtexec in a batch file. The SSIS package runs in 64 bit and we also use the 64 bit version of dtexec.
We have a task scheduler which calls the batch file which calls package. It looks like so:
cd C:\Program Files\Microsoft SQL Server\120\DTS\Binn
dtexec.exe /f "\\local\it$\Development\.NET Projects\Reporting\DailyUpload_DEV\DailyUpload\File.dtsx"
However sometimes the package will run with no problems at all and sometimes it throws an error which you can see above.
Why is this happening?
We don't change accounts, we also use admin so I know it's not a security issue.
Try adding net use before running the command so it makes that initial connection before pulling the file
Net use \\local\it$ "passwordhere" /USER:domain.username
cd C:\Program Files\Microsoft SQL Server\120\DTS\Binn
dtexec.exe /f "\\local\it$\Development\.NET Projects\Reporting\DailyUpload_DEV\DailyUpload\File.dtsx"

How to resolve UNC file issue in SSIS

I was trying to import an xls file on UNC folder using SSIS and got the below error:
[File System Task] Error: An error occurred with the following error message: "The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters."
Is there any way to resolve this issue without shortening the file name length?
This is not an access issue, as I have all the access to the full path.
I suggest mapping the network drive and path to a local drive letter?
net use t: \\myserver\my\very\long\path
In the package, then just use the mapped drive as file connectionstring.

Resources