Showing posts with label SSIS. Show all posts
Showing posts with label SSIS. Show all posts

Monday, March 5, 2012

Dynamic SSIS package configuration location at run time

I love package configurations.  They really simplify deploying SSIS packages. 

For this example, a SQL Server package configuration is used.  We have a package that imports data nightly from a text file into a SQL Server table.  The package has been created on my local server.  Here are the connection strings for the connections used by the package:

1.  Flat File Connection:  "myFlatFile"
c:\ftp\mydata.txt
2.  OLEDB Connection:  "MyDB"
Data Source=(local);Initial Catalog=MyDB;Provider=SQLNCLI10.1;Integrated Security=SSPI;Application Name=SSIS-DemoPackage-{86D8F799-4C46-4C1F-A0DD-50908FA54A04}(local).MyDB;Auto Translate=False;
3.  OLEDB Connection:  "ConfigDB"
(this is entered into the Expressions:  Connection String in the Properties of the connection)"Data Source=" + @[System::MachineName]   + ";Initial Catalog=SSISConfigurations;Provider=SQLNCLI10.1;Integrated Security=SSPI;Auto Translate=False;"
Now, for the package configuration, right-click on the Design area of your package and choose "Package Configurations".  The Package Configurations Organizer will appear.  Check the box for "Enable package configurations" and click Add.  The wizard will appear.  Here are the values for this demo:


On the next screen, expand each of your connections and check "Connection String" for each (for the purposes of this demo; you may want to choose additional elements as well). 


The last step is to name and save your configuration. 

Now - in the SSISConfigurations table in my local SSISConfigurations database, here are the values.  Note that in the ConfiguredValue column for the ConfigDB package connection, my machine name was put into the connection string by the dynamic connection string I used above.


When you deploy this package to another server (let's call it "SQLPROD"), all you have to do is import the data from the SSISConfigurations table into a database/table of the same name on SQLPROD.  Then you simply change the strings on SQLPROD to reflect the server name, like so:


And that's it!

Wednesday, September 1, 2010

SSIS Lotus Notes Integration Duct Tape Fix

So, we're switching from a server running SQL Server 2000 to a new server running SQL Server 2008.  I have this DTS package that for six years has been happily pulling data from a Lotus Notes database.  I was able to create an SSIS package that does the same thing, although using a Data Reader for the Lotus Notes data.  When I run the package itself, on the server, via BIDS, it runs fine.  However, running it from a SQL Server Agent job produces this error:
Error: 2010-09-01 12:42:19.83     Code: 0xC0047062     Source: Transfer LN_All_By_Consultant DataReader Source [1]     Description: System.Data.Odbc.OdbcException: ERROR [S1C00] [Lotus][ODBC Lotus Notes]Driver not capable  ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed  ERROR [01000] [Microsoft][ODBC Driver Manager] The driver doesn't support the version of ODBC behavior that the application requested (see SQLSetEnvAttr).  ERROR [S1000] [Lotus][ODBC Lotus Notes]Failed to switch to ID file C:\Program Files\lotus\notes\data\admin.id. Wrong Password. (Passwords are case sensitive - be sure to use correct upper and lower case.)  ERROR [28000] [Lotus][ODBC Lotus Notes]Invalid authorization specification     at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCo...  The package execution fa...  The step failed.
After searching for the answer in vain on the Internet, and hitting my head on the desk for three days, I finally came up with this solution:  I am using an Access database file on the server, linking the three Lotus tables I need via ODBC.  Then I create user queries on the linked tables, and voilĂ , SSIS is able to access these via OLE DB and I can get my data.
Of course, if anyone out there has the real solution, please let me know!