Override SSIS configuration setting on command line? - sql-server-2008

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"

Related

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\""

Dynamically set connection string of SSIS package through cmd

I am trying to dynamically set the connection string of my SSIS package through DTEXEC.exe
My CMD file consists of following command.
"C:\Program Files\Microsoft SQL Server\100\DTS\Binn\DTEXEC.exe" /f
"D:\ABC\XYZ\Packages\ABCD.dtsx" /CHECKPOINTING OFF /REPORTING V /CONSOLELOG/Conn
"Configurations;'"Data Source=XXXXXX;Initial Catalog=YYYY;Provider=SQLNCLI10.1;Integrated
Security=SSPI;Auto Translate=False;'"" /SET
"\Package.Variables[User::TargetEnvironmentId].Properties[Value]";"2"
If i take out connection string part it works fine but when i add
/Conn "Configurations;'"Data Source=XXXXXX;Initial Catalog=YYYY;Provider=SQLNCLI10.1;
Integrated Security=SSPI;Auto Translate=False;'""
This it throws exception and says INVALID
Is the name of your connection manager called "Configurations"? I can only assume that is the case. Give the following a try:
/CONNECTION "Configurations";"\"Data Source=XXXX;Initial Catalog=YYYY;Provider=SQLNCLI10.1;Integrated Security=SSPI;Auto Translate=False;\""
I always find it easier to use DTExecUI to create the script, have you tried doing that?
Either that or set the connection string as a variable and pass that through DTExec

dtexec error "The connection xxx is not found" with Project deployment model

When running DTEXEC I am getting "The connection xxxx is not found".
I beleieve this is because the connection managers are located at Project level and not within the package itself.
When running DTEXECUI - these connection managers are not displayed.
Is the only way to move them into the package - seems a bit weird as what is the point of allowing them a project level if you then have to move them to use them with DTEXEC.
Thanks
Here is the command line syntax you asked for:
C:\Users\Administrator>dtexec /FILE "\"F:\SSIS Projects\HESA\HESA\01 - Upload Metadata Files To Oracle.dtsx\"" /SET "\Package.Variables[User::varYear.Properties
[Value]";"1999" /CHECKPOINTING OFF /REPORTING EW /CONSOLELOG SMT
Your assumption that
the connection managers are located at Project level and not within the package itself
is exactly the problem. But there is a solution:
build the project to get a .ispac file
instead of invoking dtexec with /FILE you have to invoke it with /Project and /Package, like this:
/Project "path to you .ispac file, resulting from building the project"
/Package "Name of your package.dtsx"
Please, be aware that if you provide the whole path to your .dtsx package the execution will fail with very criptic SQLDUMPER error messages.

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.

How to use DontSaveSensitive and xml configuration file during SSIS package development

Is it somhow possible to set the ProtectionLevel of SSIS package to DontSaveSensitive and to use connection string with password from configuration file during package development in Visual Studio?
I have package e.g. Package1 with ProtectionLevel = DontSaveSensitive. This package is using connection from connection manager e.g. Connection1.
Package1 has configuration enabled using configuration file file1.dtsConfig with connection string specified. This connection string has the password in it:
<DTSConfiguration>
<DTSConfigurationHeading>
<DTSConfigurationFileInfo GeneratedBy="..." GeneratedFromPackageName="..." GeneratedFromPackageID="..." GeneratedDate="20.3.2013 12:08:27"/>
</DTSConfigurationHeading>
<Configuration ConfiguredType="Property" Path="\Package.Connections[Destination].Properties[ConnectionString]" ValueType="String">
<ConfiguredValue>Data Source=.;Password=Password123;User ID=MyUser;Initial Catalog=Catalog;Provider=SQLNCLI10.1;Persist Security Info=True;Auto Translate=False;</ConfiguredValue>
</Configuration>
</DTSConfiguration>
Now when opening the connection from connection manager in Visual Studio, the text field for Password is left blank and the package doen't execute. Why wasn't used the password specified within the connection string in configuration file file1.dtsConfig?
Finally we found a way how to do it:
Change ProtectionLevel to DontSaveSensitive
Create configuraton file with connection string
Manually edit this configuration file: add the password to the connection string in case you connect with SQL Server authentication
Then SSIS package will load the connection string inclusive password from the configuration file even in Visual Studio. In connection manager-connection dialog the password will not be shown, but the package runs using connection string from configuration.
SSIS will take the connection string from the Config File only during the runtime.Even if you mark the checkbox Save my Password , SSIS won't save the password value.This option is vald only during the BIDS session. So the next time when you open the package using BIDS ,again you need to enter the credentials in Visual Studio else the package won't compile ,But the package will always execute properly during run time if you have specified the connection string in config file.
As per MSDN it clearly states that
Do not save sensitive : prevents properties that are marked sensitive
from being saved with the package and therefore makes the sensitive
data unavailable to other users.
This is the case also when package has been set at first to use EncryptSensitiveWithUserKey, then changed to DontSaveSensitive -protection level. You must manually edit .conmgr-file and remove DTS:Password element and put the password into connection string, as user dee has wisely written above.