Hi There: I have a SSIS package(VS.Net) that has different ADO.NET connection . These connect to SQL Server Data base from my package. Now by default the Package Protection level is set to EncryptSensitiveWithUserKey. Previously, I was only using Windows Authentication in my Package to connect to SQL Server DB. So when other users were using this package they never had any issue to run the package. I also created a .Net Form Application. The users just Run/Click this application and this application then run the package from a shared folder. We never had any issue. Next I had to add a new connection with SQL Server Authentication. This time the users were not able to run the package. They run the Click application and get the error. The error was"Don't have proper permission to access to MY_DB_TABLE". Here "MY_DB_TABLE" is the table that I was connecting to from my package using SQL Server Authentication.
Solution: I changed the Package Protection level to EncryptSensitiveWithPassword. Then I entetred a Password(Say 3456) for the package and Build the package again. I added this Package level password to my Command line parameters in my .Net Click application. I built the Click application and run it. Everything looks fine. The users are also able to run it without worrying about the password. The Package password(Note: it is not the data base connection password), is visible in the Command line. Bu the users will only run this built application and will not see the code(If not necesary).
The Command Line application command:
String spath = "/FILE \\\\MyPackageServer100\\Projects\\Test\\DataTransfer.dtsx /CHECKPOINTING OFF /DECRYPT 3456";
System.Diagnostics.
Process p =new System.Diagnostics.Process();p.StartInfo.FileName =
@"C:\Program Files\Microsoft SQL Server\100\DTS\Binn\DTExec.exe";
p.StartInfo.Arguments = spath;
p.StartInfo.UseShellExecute =
false;p.StartInfo.CreateNoWindow =
true;p.StartInfo.RedirectStandardOutput =
true;p.Start();
StreamReader reader = p.StandardOutput;
string sr = reader.ReadToEnd();
StreamWriter sw =File.CreateText(@"\\MyPackageServer100\\Projects\\Test\Output.txt");
sw.WriteLine(sr);
sw.Close();
reader.Close();
p.WaitForExit(); -----Thats it. Please comment if it helps you. Thanks.