SSIS C# Script using Google.Apis.Auth.OAuth2; - ssis

I made a C# Script in SSIS pulling data from GA API. On Monday, Google closed the access to the api via basic authentication
AnalyticsService service = new AnalyticsService(Dts.Variables["CONFIG_GA_PROJECT"].Value.ToString());
service.setUserCredentials(username, pass);
=> Got 404 error
So I want to move to the following security implementation : Accessing older GData APIs (Spreadsheet API) using OAuth 2 and a service account
The problem is : seems like we can't use nuget installation in SSIS Script as dll has to be pushed in the GAC.
I tried using : How to install a DLL to the GAC on Windows Server 2012 using only PowerShell (without having to install SDK or Visual Studio) but didn't work...
Is anyone found a way to use Google.Apis.Auth.dll in a SSIS C# Script task ?

The problem you are having is due to the fact that the Google .net client library aren't strong name signed, so they cant be pushed to GAC. Also remember that the current Google .net client only works with .net 4 and .net 4.5 so you are going to be locking out the older versions of SSIS I think.
This is reason I didn't use them in my Google Analytics Custom SSIS Data Reader and Connection Manager which uses Oauth2.
Options:
Strong name sign the Client library yourself. code here
Wait for the strong name signed version of the library to be released. I hope its done soon. Strong Naming in binaries #238
Do what I did and code it all yourself with out the Client library, this allows you to code for .net 3.0 and support SQL server 2005 - 2012 like mine.
I hope this helps. The one I made is free for download you are welcome to have a look Data Reader for Google Analytics

Related

.NET dll using different TLS versions

We have a Microsoft Access application that consolidates many of our activities on eBay. I do this through several com dll's that Access references. One part of the application posts listings from our inventory to eBay. This has been working for at least 8 years. Recently eBay changed it's servers to require TLS 1.2 and we started getting "The request was aborted: Could not create SSL/TLS secure channel" message. Looked this up and MS says upgrading the dll project to Framework 4.7 or later will fix. I upgraded the solution framework and recompiled.
The upgraded dll works with eBay when I call from a win forms test application built in VS. When I call from the Access application I still get the TLS error. When I looked at the communications with eBay in Fiddler the calls coming from the dll when called from the .NET win forms test app use TLS 1.2. When the dll is called from Access it is still using TLS 1.0. Both the Access app and the .NET test app reference the same dll file.
Question: does the application calling a dll influence the TLS version being used? Any ideas on what could be causing different TLS version being used by the same dll?
Hum, I did not think that VBA/Office being the host program would change the TLS settings. But you could consider trying this registry edit:
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v2.0.50727]
"SystemDefaultTlsVersions" = dword:00000001
"SchUseStrongCrypto" = dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319]
"SystemDefaultTlsVersions" = dword:00000001
"SchUseStrongCrypto" = dword:00000001
I believe you also have to re-start your computer for above to take effect.

How to use a SQL Server Integration Services (SSIS) custom Connection Manager programmatically?

I am trying to programmatically create an SSIS package from a C# console application that uses a 3rd party Custom Connection Manager for Kafka like so:
static void Main(string[] args)
{
Application app = new Application();
Package pkg = new Package();
ConnectionManager cmKafka = pkg.Connections.Add("KAFKACS");
...
which fails with:
Microsoft.SqlServer.Dts.Runtime.DtsRuntimeException
The connection type "KAFKACS" specified for connection manager ... is not
recognized as a valid connection manager type.
Adding this manager to an Integration Services Project from Visual Studio 2017 works just fine, however.
I am new to SSIS, C# and Windows development. Here's what I've tried so far:
Add GAC references to KAFKACS assemblies to my console application.
Force 64bit execution which results in Microsoft.SqlServer.DTSRuntimeWrap not found.
Use reflection to try to figure out what architecture and for what .NET framework version the Kafka DLLs I reference target (looks like MSIL).
Create versions of the same application using previous versions of .NET target framework.
Try to manually create an instance of the Kafka manager as shown here:
var rawKafka = new KafkaConnectionManager();
ConnectionManager cmKafka = (???) rawKafka;
pkg.Connections.Join(cmKafka);
Do I need to register the KAFKACS component in order for the call to Connections.Add to succeed?
Are the error messages misleading and I am missing other, perhaps Kafka specific assemblies I need to reference?
Can I manually create a instance of the KafkaConnectionManager and use it with Connections.Join?
To answer my question, the issue had been that the 3rd party Connection Manager was build for SQL Server 2017 (v14) but the console application referenced the ManagedDTS assembly for 2016 (v13).
The call to pkg.Connections.Add("KAFKACS") could not find the DLLs since the 3rd Party installer had installed them in C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Connections (where 140 corresponds to v14) and not in \130\DTS\Connections where v13 of ManagedDTS would expect to find them.

cas jasig using oracle data source on windows

is there any way that can help cas settings to use the data source oracle on windows
in my company will apply singgle singgle sign on and logout, I've been trying for 5 days, and until now have not been successful.
I've tried several ways
I use
Tomcat 7.0
Java 1.7
cas server 3.5.2
Tomcat 7.0
Java 1.7
cas server 3.5.2
I downloaded cas server 3.5.2
extract cas-server-3.5.2
copy cas-server-webapp-3.5.2.war into tomcat webapps
cas has been successfully deployed, and can be accessed
and then I do not understand anymore, how do I get the authentication process can use oracle database
sorry my english is not good
thank you
There's a few things you need to do:
First of all, if you haven't downloaded and included the Oracle JDBC Driver library (http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html) then you have to do that.
Secondly, you need to configure the JDBC plugin: https://wiki.jasig.org/display/CASUM/JDBC
These instructions (and the preferred method of customizing & building CAS) uses the Maven Web Overlay method. This has the advantage that you deploy lots of un-necessary libraries that you aren't using.

How to run SSIS packages from an external application?

I have an application I am writing that accepts files of various formats. Then I write code for each format (csv, excel, xml) to convert it and enter it into a SQL Server database. This is fine but I was just looking into SSIS and wondering if this would help.
The main question though is how do I run these packages within my own code? Is it easy to pass parameters? If I move this web app to another server does it depend on other components being on that server (maybe SQL Server 2012 installed)? Or is it just some DLLs I can reference from my web app?
All the demos I see are about using the SSIS tool but I am more interested in how difficult it is to call packages with parameters from my code.
The BIDS/SSDT installation includes a complete client SDK that makes it pretty simple to run SSIS packages via code.
This MSDN article explains how to load and run a package via C# in detail but the actual code boils down to:
using Microsoft.SqlServer.Dts.Runtime;
.
.
.
Application app = new Application();
Package pkg = app.LoadPackage(PKG_FILE_NAME, null);
DTSExecResult pkgResults = pkg.Execute();
The Package object has a lot of properties and methods you can look into, in particular there is a Parameters collection that allows you to pass parameters into your SSIS package before execution.
There is a very cool library called EzAPI where you can generate your own packages and call them from within C#. It gives you a lot of flexibility to generate SSIS on the fly and execute.
http://sqlsrvintegrationsrv.codeplex.com/releases/view/21238
I built a couple console apps inside this project to test some of these methods and you might find the examples useful:
https://github.com/thevinnie/SyncDatabases
Look at "BuildingAPackage" and "BuildALookupPackage"
You can programmatically build SSIS packages using C# or VB.NET and then run the packages. You can also load an existing package programmatically to execute it. I have little experience with building packages this way since most of the packages can be built easily using the following tools.
Read the article Building Packages Programmatically on MSDN for more details.
I feel that it is easier to build the packages through these IDEs depending on which version of SSIS you are targeting. You can also create initial packages through SQL Server Import and Export Wizard and save the SSIS packages to the local disk, which you can later modify according to your needs.
SSIS Version Development IDE Visual Studio Shell
------------------- ----------------------------------------------- -------------------
SSIS 2005 Business Intelligence Development Studio (BIDS) Visual Studio 2005
SSIS 2008 - 2008 R2 Business Intelligence Development Studio (BIDS) Visual Studio 2008
SSIS 2012 SQL Server Data Tools (SSDT) Visual Studio 2010
You need to reference the appropriate SSIS specific DLLs in your code to create/load SSIS packages.
However, you will need a SQL Server Integration Services license to run the package. You cannot simply reference the DLLs alone. The license is usually part of your SQL Server license, if you already have one.
Response to your comment:
We will have SQL 2012 or 2008R2 on a separate server.. So I just need to paste the needed DLLs on my web server and reference them. correct ?
The packages will execute on that server. You are just remotely invoking to execute them and you should reference the appropriate DLLs in the code within your web/other form of external application. I usually schedule the packages to run on the database servers under SQL Server Agent Job. You can try that if that is an option for you.
Package parameters are read-only from an external application. You'll need to pass them in as variables (which I have done). If you are dealing with an existing package with parameters, you may consider writing a script task that populates the parameters from the variables (which I have not done).

Unzip password protected Zip file in SSIS

Does anyone know how to Unzip password protected files in an SSIS package?
We have an SSIS package that currently use java.util.zip to unzip zip file and has been working perfectly for some time now. They now want to password protect the files and unfortunetly this library cannot do it.
We are using a SQL server 2008 with .Net 3.5 on the windows server 2008 R2.
I have enjoyed using DotNetZip, it's free, has rich functionality and is well documented
DotNetZip
examples of using it in SSIS
You would have to write a C# script that has the password and you would be able to unzip it using the built in .Net library.
Use an execute process task and call winzip, IZArc or similar program you can drive from the command line. Use the expressions properties to dynamically set paths and passwords for the command line
PragmaticWorks have a "TF Compression Task" in their Task Factory suite which handles password protected zip files very nicely. You'll need to buy a sever license to use their suite in production, but you can download and use it free within VS2008 BIDS.
I've got a licensed copy of Task Factory and would recommend it to anyone who uses SSIS in a corporate environment.