We have many SSIS packages stored on a network drive. Every package has a connection manager called config_connection and all the package configurations are stored in a database that config_connection manager points to.
On execution we would like to override the connection string being used for the config_connection connection manager. This should be possible using the /connection parameter on dtexec.exe
This only actually works in one situation though. If the original connection string is inaccessible then eventually the override works after it fails to connect to the existing connection string.
I've used dtexecui to create the command line execution and it works when the original connection is blank so it doesn't seem to be an issue with the command line.
DTExec.exe /FILE "\"C:\PackageName.dtsx\"" /CONNECTION "\"config_connection\"";"\"Provider=MSOLEDBSQL.1;Persist Security Info=False;Data Source=ServerName;Use Encryption for Data=True;Authentication=ActiveDirectoryIntegrated;Initial Catalog=ETL_Management\"" /CHECKPOINTING OFF /REPORTING V /CONSOLELOG XMT
I've tested this on dtexec 2012, 2017 and 2019 and all have the same behaviour. I've done quite a bit of googling and there was a link on another post here that may have explained some more detail but it was a broken link and a search didn't help.
If anyone has any ideas or links to documentation that would explain this behaviour I'd appreciate it.
Edit 2023-05-23:
I've created a brand new package with 3 connections: config_connection, logging_ole and Recyclebin_OLE
At design time all 3 of these connect to the same server. The xml of the configuration in the package is:
<DTS:Configurations>
<DTS:Configuration
DTS:ConfigurationString=""config_connection";"[dbo].[DWConfigurations]";"Logging_OLE";"
DTS:ConfigurationType="7"
DTS:CreationName=""
DTS:DTSID="{E9527CAF-6936-40A2-BFEC-415F80CA1BBF}"
DTS:ObjectName="Logging_OLE" />
<DTS:Configuration
DTS:ConfigurationString=""config_connection";"[dbo].[DWConfigurations]";"RecycleBin_OLE";"
DTS:ConfigurationType="7"
DTS:CreationName=""
DTS:DTSID="{A76E0FC1-E657-482E-933B-3A8E56CFE436}"
DTS:ObjectName="RecycleBin_OLE" />
</DTS:Configurations>
I've added a variable vServerName with the type of string.
Then I've created 3 execute sql tasks which set the value of vServerName to the server name returned by
SELECT @@SERVERNAME AS ServerName
then used the script task to echo the value.
running the package without the override returns the following result as expected.
Started: 14:01:49
Info: 2023-05-23 14:01:49.73
Code: 0x40016040
Source: Package1
Description: The package is attempting to configure from SQL Server using the configuration string ""config_connection";"[dbo].[DWConfigurations]";"Logging_OLE";".
End Info
Info: 2023-05-23 14:01:49.94
Code: 0x40016040
Source: Package1
Description: The package is attempting to configure from SQL Server using the configuration string ""config_connection";"[dbo].[DWConfigurations]";"RecycleBin_OLE";".
End Info
Info: 2023-05-23 14:01:49.96
Code: 0x40016040
Source: Package1
Description: The package is attempting to configure from SQL Server using the configuration string ""config_connection";"[dbo].[DWConfigurations]";"Logging_OLE";".
End Info
Info: 2023-05-23 14:01:49.98
Code: 0x40016040
Source: Package1
Description: The package is attempting to configure from SQL Server using the configuration string ""config_connection";"[dbo].[DWConfigurations]";"RecycleBin_OLE";".
End Info
Progress: 2023-05-23 14:01:51.81
Source: Execute SQL Task config_connection
Executing query "SELECT @@SERVERNAME AS ServerName".: 100% complete
End Progress
Info: 2023-05-23 14:01:51.84
Code: 0x00000000
Source: Script Task config_connection SCR Echo Back
Description: User::vServerName : az-bpsqmiXX.XXXXXXXX.database.windows.net
End Info
Progress: 2023-05-23 14:01:52.02
Source: Execute SQL Task Logging_OLE
Executing query "SELECT @@SERVERNAME AS ServerName".: 100% complete
End Progress
Info: 2023-05-23 14:01:52.02
Code: 0x00000000
Source: Script Task logging_ole SCR Echo Back
Description: User::vServerName : END-BPSQ08-VS01\INSTANCE01
End Info
Progress: 2023-05-23 14:01:52.12
Source: Execute SQL Task Recyclebin_OLE
Executing query "SELECT @@SERVERNAME AS ServerName".: 100% complete
End Progress
Info: 2023-05-23 14:01:52.12
Code: 0x00000000
Source: Script Task Recyclebin_OLE SCR Echo Back
Description: User::vServerName : END-BPSQ08-VS01\INSTANCE01
End Info
DTExec: The package execution returned DTSER_SUCCESS (0).
Started: 14:01:49
Finished: 14:01:52
Elapsed: 2.531 seconds
I have confirmed repeatedly that the configuration stored in the table are pointing to the correct xml path
\Package.Connections[RecycleBin_OLE].Properties[ConnectionString]
\Package.Connections[Logging_OLE].Properties[ConnectionString]
Interestingly if in the designer I blank the connection string for config_connection, do this in offline mode if you don't want designer to freeze while it checks the invalid connection string, then all 3 are overridden correctly. Even though I didn't blank out the others.
Started: 14:03:40
Info: 2023-05-23 14:03:40.44
Code: 0x40016040
Source: Package1
Description: The package is attempting to configure from SQL Server using the configuration string ""config_connection";"[dbo].[DWConfigurations]";"Logging_OLE";".
End Info
Error: 2023-05-23 14:03:40.45
Code: 0xC0202009
Source: Package1 Connection manager "config_connection"
Description: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E4D.
An OLE DB record is available. Source: "Microsoft OLE DB Provider for SQL Server" Hresult: 0x80040E4D Description: "Invalid authorization specification".
End Error
Info: 2023-05-23 14:03:40.45
Code: 0x40016040
Source: Package1
Description: The package is attempting to configure from SQL Server using the configuration string ""config_connection";"[dbo].[DWConfigurations]";"RecycleBin_OLE";".
End Info
Error: 2023-05-23 14:03:40.45
Code: 0xC0202009
Source: Package1 Connection manager "config_connection"
Description: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E4D.
An OLE DB record is available. Source: "Microsoft OLE DB Provider for SQL Server" Hresult: 0x80040E4D Description: "Invalid authorization specification".
End Error
Warning: 2023-05-23 14:03:40.45
Code: 0x80012059
Source: Package1
Description: Failed to load at least one of the configuration entries for the package. Check configuration entries for "Logging_OLE; RecycleBin_OLE" and previous warnings to see descriptions of which configuration failed.
End Warning
Info: 2023-05-23 14:03:40.45
Code: 0x40016040
Source: Package1
Description: The package is attempting to configure from SQL Server using the configuration string ""config_connection";"[dbo].[DWConfigurations]";"Logging_OLE";".
End Info
Info: 2023-05-23 14:03:41.97
Code: 0x40016040
Source: Package1
Description: The package is attempting to configure from SQL Server using the configuration string ""config_connection";"[dbo].[DWConfigurations]";"RecycleBin_OLE";".
End Info
Progress: 2023-05-23 14:03:43.22
Source: Execute SQL Task config_connection
Executing query "SELECT @@SERVERNAME AS ServerName".: 100% complete
End Progress
Info: 2023-05-23 14:03:43.24
Code: 0x00000000
Source: Script Task config_connection SCR Echo Back
Description: User::vServerName : az-bpsqmiXX.XXXXXXXX.database.windows.net
End Info
Progress: 2023-05-23 14:03:44.32
Source: Execute SQL Task Logging_OLE
Executing query "SELECT @@SERVERNAME AS ServerName".: 100% complete
End Progress
Info: 2023-05-23 14:03:44.32
Code: 0x00000000
Source: Script Task logging_ole SCR Echo Back
Description: User::vServerName : az-bpsqmiXX.XXXXXXXX.database.windows.net
End Info
Progress: 2023-05-23 14:03:45.40
Source: Execute SQL Task Recyclebin_OLE
Executing query "SELECT @@SERVERNAME AS ServerName".: 100% complete
End Progress
Info: 2023-05-23 14:03:45.41
Code: 0x00000000
Source: Script Task Recyclebin_OLE SCR Echo Back
Description: User::vServerName : az-bpsqmiXX.XXXXXXXX.database.windows.net
End Info
DTExec: The package execution returned DTSER_SUCCESS (0).
Started: 14:03:40
Finished: 14:03:45
Elapsed: 5.125 seconds
It's such a strange issue!