Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Executing SSIS package with config file

Author  Topic 

im1dermike
Posting Yak Master

222 Posts

Posted - 2009-07-24 : 11:48:54
I have a C# program which calls an SSIS package that exists on my file system. I've been using the following lines of code to call the package:
Microsoft.SqlServer.Dts.Runtime.Application TRANSFERDATA = new Microsoft.SqlServer.Dts.Runtime.Application();
Package package = TRANSFERDATA.LoadPackage(location + p, null);
DTSExecResult ResultProcess = package.Execute();

I recently needed to move the package to other non-test machines. To do this, I created a *.dtsConfig package configuration file which I'm accompanying with the *.dtsx package file. When I open the package in VS2005 on the production machine and execute it, it runs fine. When I try to execute the package with the code above, though, it doesn't work. I get the following error, crashing on the second line:

{"The package failed to load due to error 0xC0011008 \"Error loading from XML. No further detailed error information can be specified for this problem because no Events object was passed where detailed error information can be stored.\". This occurs when CPackage::LoadFromXML fails.\r\n"}

Do I need to somehow load the config file too?

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2009-07-24 : 12:07:33
I have not executed packages in that manner, that being said, they run in the context of the calling environment. So, where ever your C# app is calling the packages at, that is where you would need to place your config file. That is why it is working when you are running it directly on the produciton machine.
Go to Top of Page

im1dermike
Posting Yak Master

222 Posts

Posted - 2009-07-24 : 12:10:53
Lamprey: The location of the *.dtsConfig file is not changing. It's located in the same directory as the *.dtsx package.
Go to Top of Page

im1dermike
Posting Yak Master

222 Posts

Posted - 2009-07-24 : 12:27:01
I think it's an issue with the BIDS tools installed on the production machine because the execution code works on my machine using the config files.
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2009-07-24 : 13:52:03
How is the location of the config file configure within package? Is it pointing to a local file (C:\..) or to a UNC file (\\ServerName\...)?

Because if it's a local path, then the executing environment has to have the file in the same path.

For example:
You have a package named PackageA.dtsx located on ServerA at C:You also have a config file named Config.dtsConfig located on ServerA at C:
If you try to execute PagageA on ServerB then you have to have a congig file on ServerB at C:\. The package thinks it is running on ServerB even if it is physically located on ServerA.

I just wanted to clarify, incase you thought that having the package and config file together made a difference.
Go to Top of Page

im1dermike
Posting Yak Master

222 Posts

Posted - 2009-07-24 : 13:55:16
I believe I've figured it out. It has nothing to do with the config file or even the package. SQL Server Integration Services is missing from that machine. I'm trying to install it now despite Microsoft trying it's hardest to prevent me.
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2009-07-24 : 13:56:25
Hehe, yeah, that makes it tough to run packages.. :)
Go to Top of Page

fredong
Yak Posting Veteran

80 Posts

Posted - 2010-01-27 : 16:53:22
Hi m1dermike,
I have almost have the same problem like you. I am using SQL 2008 BIDS SSIS. I have created a OLEDB XML config file name 'TestConnection' and reside on my Test and Production C:\Configfile\TestConnection.dtsconfig and each configuration file calling it Datas source pointing to each respective server. On the SSIS package Script task I am using C# and I want to call this 'TestConnection'. I have my code below. Can you show me the how to call the 'TestConnection' ? Thanks.



using System;
using System.Data;
using System.Math;
using System.Configuration;
//using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
//using Microsoft.SqlServer.Dts.Runtime.Wrapper;
using System.Data.SqlClient;
using System.Data.OleDb;
using Microsoft.SqlServer.Dts.Runtime;

namespace ST_22763bdd02604c9897f02329d21753d5.csproj
{
[System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")]
public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
{


public class ScriptMain : UserComponent
{

IDTSConnectionManager90 connMgr;
SqlConnection SqlConn;
SqlCommand sqlCmd;
SqlParameter SqlParam1;
SqlParameter SqlParam2;



public override void AcquireConnections(object Transaction)
{
string SqlConn = ConfigurationManager.ConnectionStrings["TestConnection"].ConnectionString;;
SqlConn = (SqlConnection)connMgr.AcquireConnection(null);
sqlCmd = new SqlCommand("exec Exec etmtech.dbo.sp_MyStoreProcedure", SqlConn);
sqlCmd.CommandType = CommandType.StoredProcedure;

|
|
|






k
Go to Top of Page
   

- Advertisement -