When do SSIS Connections occur? - ssis

Do SSIS ConnectionManagers attempt to make their connections on package start, or when the connection is first used?
If it's the latter, I can use failure transitions to handle connection failures within the package, but if it's the former then I have to do it externally.
I can assume that they'd design it with the latter, but I can't find it in the documentation anywhere easily searchable/accessible.

It depends and can be controlled.
With the default setting of DelayValidation=false property, SSIS engine at package start tries to connect (validate) all Connection Managers and tasks with metadata and which use Connection Managers like Data Flows etc.
If you set DelayValidation=true on the Connection Manager itself and all relevant tasks, then the first connection on the Connection Manager for the validation would be executed right before the task is executed. This is quite helpful if you use expressions on Connection Manager properties, like dynamic connection string, and before package execution it cannot be evaluated.

In SSIS,it always try to validate connection manager at the package start time.
Once the SSIS package start, it first validate for all parameter, variable and connection manager etc.

Related

SSIS OLEDB connection not saving password when setting connection string from package configurations

I am setting up an SSIS project for testing. This project has a package where I manage some connections to SQL Server data bases, for doing this I use Package Configurations. Here I have a configuration that takes four connection strings from a table. Each is being mapped to connection string property of SSIS OLEDB connection (As shown in next image).
When I turn off "Work offline" and test the connection it works, the problem is that when execute the solution it logs some errors that are releated with the incorrect login to the data base.
I tried to do some workaround for this by setting everything manually (without Package Configurations) and changing protection level to "EncryptSensitiveWithPassword" and it worked.
It seems that the password of the connection string is not being saved when being taken from package configurations.

SSIS package tasks copy paste and keep connection manager name

I have some larger SSIS package processes I wrote in a test package and I want to copy/past it into an existing package. I have connection managers in both packages that have the same name. When I copy from one package to the other, it creates a new connection manager but with a "1" at the end of it.
Is there a way to have it NOT do this and just use the existing package connection manager with the same name?
Otherwise I will have to go into all the tasks, update the connection manager, and in places it resets the tables I was inserting into and I will have to redo all that as well.
Any suggestions?
Also is there anyway to update a variable name in many tasks easily? I just want to rename a variable but dont want to have to go in and edit every task to do so.
You can use a project level connection manager instead of using package level connection manager.
Right click on Connection Manager in solution explorer and create the connection manager. This connection manager will be common to all the packages. You can change the tables for this connection manager where you are using it. For all packages it will point to same database.
As you can see in below snapshot PackageLevel_ConManager is not visible, but Project level is visible in both the snapshot.

Description: component "MyDataFlowOLEDBSourceComponent" (10250) failed the pre-execute phase and returned error code 0xC0202009

I have an SSIS package that has run for months daily with no problem. Suddenly it is failing every day with the error above. No changes to the package or the stored procs it runs have been pushed, to my knowledge, no changes to the database environment have been made including permissions for the service account that owns the job.
This is a SQL Server 2008 package that connects to a SQL server 2008 R2 database. The configuration is through the ssisconfig table and it defines which server to use through an environment variable.
The component in question is using a stored proc. In the proc, all fields are explicitly cast to the same data type of the table the data is being staged too. The proc runs fine by itself. It is a relatively complex proc that has two table variables and a CTE.
I can't run it from my local on prod and dev is not failing. If I open the prod SSIS package while I am set to the environment variable that the job owner uses, I do not get a validation error on this component. ValidateExternalMetadata is set to true for this component. For the entire package though, Delay Validation is set to True. I do get a validation error that would be expected on a task using a variable that is set dynamically in an earlier task. This error, however, is many, many steps later than the step it is currently failing on.
Usually in the past when we have had this sort of unspecific error, I have been easily able to see the problem with the data that caused the sudden failure. But none of the data in the proc result set is even close to being incorrect for the datatypes defined for staging table for that field. None of the required fields are missing data either.
I am out of ideas for what else to look at. If the environment didn't change, the actual code didn't change and the data looks correct, what is left to try?
As I have commented for details error, you can try below link from Microsoft:
Debug SSIS Package while calling from Agent
Some info from link:
Reasons that the package may have failed are as follows:
The user account that is used to run the package under SQL Server Agent differs from the original package author.
The user account does not have the required permissions to make connections or to access resources outside the SSIS package.
The package may not run in the following scenarios:
The current user cannot decrypt secrets from the package. This scenario can occur if the current account or the execution account
differs from the original package author, and the package's
ProtectionLevel property setting does not let the current user
decrypt secrets in the package.
A SQL Server connection that uses integrated security fails because the current user does not have the required permissions.
File access fails because the current user does not have the required permissions to write to the file share that the connection
manager accesses. For example, this scenario can occur with text
log providers that do not use a login and a password. This scenario
can also occur with any task that depends on the file connection
manager, such as a SSIS file system task.
A registry-based SSIS package configuration uses the HKEY_CURRENT_USER registry keys. The HKEY_CURRENT_USER registry keys
are user-specific.
A task or a connection manager requires that the current user account has correct permissions.
Method 1: Use a SQL Server Agent proxy account Create a SQL Server Agent proxy account. This proxy account must use a credential that
lets SQL Server Agent run the job as the account that created the
package or as an account that has the required permissions.
This method works to decrypt secrets and satisfies the key
requirements by user. However, this method may have limited success
because the SSIS package user keys involve the current user and the
current computer. Therefore, if you move the package to another
computer, this method may still fail, even if the job step uses the
correct proxy account.
Method 2: Set the SSIS Package ProtectionLevel property to ServerStorage Change the SSIS Package ProtectionLevel property to
ServerStorage. This setting stores the package in a SQL Server
database and allows for access control through SQL Server database
roles.
Method 3: Set the SSIS Package ProtectionLevel property to EncryptSensitiveWithPassword Change the SSIS Package ProtectionLevel
property to EncryptSensitiveWithPassword. This setting uses a password
for encryption. You can then modify the SQL Server Agent job step
command line to include this password.
Method 4: Use SSIS Package configuration files Use SSIS Package configuration files to store sensitive information, and then store
these configuration files in a secured folder. You can then change the
ProtectionLevel property to DontSaveSensitive so that the package is
not encrypted and does not try to save secrets to the package. When
you run the SSIS package, the required information is loaded from the
configuration file. Make sure that the configuration files are
adequately protected if they contain sensitive information.
Method 5: Create a package template For a long-term resolution, create a package template that uses a protection level that differs
from the default setting. This problem will not occur in future
packages.
Above link will help you through logging and other possible scenarios of failure of your package from SQL Agent. I suspect that your user of Agent has been corrupted. But that is an assumption. You first enable the logging of SSIS by following link :
Enable SSIS Package Logging
Some info from link
To set the logging level for a package by using the Execute Package
dialog box
In SQL Server Management Studio, navigate to the package in Object Explorer.
Right-click the package and select Execute.
Select the Advanced tab in the Execute Package dialog box.
Under Logging level, select the logging level. See the table below for a description of available values.
Complete any other package configurations, then click OK to run the package.
Hope this will help you in the first place. If not please let me know.

Close Connection on completion in SSIS

anybody aware of "Close Connection on completion" option in DTS.
I am searching for the equivalent option for OLEDBDestinationTask in SSIS.
To answer your question directly: this is done automatically.
The SSIS Connection Manager behaves differently to the way the DTS Connection works. The Connection Managers maintain a pool of connections. Each task that utilises the Connection Manager will get its own connection to the data source - in comparison to DTS, where if the same connection object is used, the same physical connection will be maintained throughout the package.
Apart from that, you can actually make the SSIS Connection Manager behave like a DTS Connection by setting RetainSameConnection=True

Why does SSIS connection works with Windows but not with SQL Server authentication?

I have an SSIS package that contains a Lookup Transformation. This requires a connection to the database. At the connection manager, when I use the Windows authentication the connection works fine but when I use SQL Server Authentication then I get this error:
[A140_DAMAGETYPETEXT [3799]] Error: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager "servername.Datenbankname.sqlUser" failed with error code 0xC0202009. There may be error messages posted before this with more information on why the AcquireConnection method call failed.
Connection string:
Data Source=TheServerName;User ID=TheSQLUser;Initial Catalog=TheDababase;Provider=SQLNCLI10.1;Persist Security Info=True;Application Name=NameOfThePackage{80F4BFAB-642D-457E-9F47-1E811AFA48D0}ServerName.TheDababas‌​e.TheSQLUser;
Cause of the issue:
Your connection string is missing the Password attribute. That is the reason why the connection manager is failing to connect to the database instance.
Possible option to fix:
When you create the connection manager on SSIS, make sure to check the Save my password box so that the Password is retained in the connection string. If you do not check this box, the value will not be retained and you have to key in the value.
Package configuration:
If you are using package configurations, adding / updating the connection manager will cause the Password attribute to drop from the connection string property. I usually use database based package configuration. So, I use a query to update the connection string in the package configuration table every time I update the package configurations.
Recommendation:
I prefer to use Windows authentication so that the password to connect to the database is not exposed. I feel that Windows Authentication is little more secure than dealing with SQL Server Authentication.
here was the solution for me: click
the thread from Raj_007 was the rescue. I use a sequece container and the TransactionOption was setting to required.
I changed the TransactionOption to supported and it worked for me.