hcvst
hcvst

Reputation: 2925

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:

var rawKafka = new KafkaConnectionManager(); 
ConnectionManager cmKafka = (???) rawKafka; 
pkg.Connections.Join(cmKafka); 

Upvotes: 1

Views: 631

Answers (1)

hcvst
hcvst

Reputation: 2925

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.

Upvotes: 2

Related Questions