programming4us
programming4us
DATABASE

Using SQL Server 2005 Integration Services : Extensibility (part 4) - Custom Connection Managers

7/7/2012 6:21:22 PM

Custom Connection Managers

Integration Services supports the notion of pluggable connection manager components. If you build and register a connection manager component, it will appear in the list of available connection types when you right-click in the Connection Managers tray and choose New Connection.

To build a custom connection manager, create a Class Library project in Visual Studio. Add a reference to the Microsoft.SqlServer.ManagedDTS assembly. In the project properties, go to the Signing tab and select the Sign The Assembly check box. Use a key file you already have, or create a new key file by clicking New.

Next, create a class derived from ConnectionManagerBase and add the DtsConnection attribute to the class. Build the project, and add the compiled assembly to the GAC. Also copy the assembly to %ProgramFiles%\Microsoft SQL Server\90\DTS\Connections. Restart SQL Server Business Intelligence Development Studio, and you should see your custom connection manager in the list of available connection managers, as shown in Figure 6.

Figure 6. Add SSIS Connection Manager

Listing 5 shows sample code for a custom connection manager class.

Listing 5. An Example of a Custom Connection Manager Class
using System;
using Microsoft.SqlServer.Dts.Runtime;

namespace CustomConnectionManager
{
    public class MyConnection
    {
        // TODO: Implement your connection class
    }
    [DtsConnection(
        ConnectionType = "MYCONN",
        DisplayName = "My Custom Connection",
        Description = "Connection manager for my custom type of connections")]
    public class CustomConnectionManager : ConnectionManagerBase
    {
        public override object AcquireConnection(object txn)
        {
            MyConnection myConnection = new MyConnection();
            // TODO: Add code to open your type of connection
            return (object) myConnection;
        }

        public override void ReleaseConnection(object connection)
        {
            MyConnection myConnection = (MyConnection)connection;
            // TODO: Add code to close your type of connection
        }
    }
}

					  

Log Providers

Custom log providers are useful when you want to integrate Integration Services logging with a system of logging you already have in place. The custom log provider sees the stream of log entries just as the built-in log providers do. What you do with these log entries is up to you.

To create a custom Log Provider component, you follow the steps given earlier for creating a custom connection manager except that your class should be derived from LogProviderBase and the attribute on that class should be DtsLogProvider. Copy the compiled assembly to %ProgramFiles%\Microsoft SQL Server\90\DTS\LogProviders.

Foreach Enumerator

You might want to create a custom Foreach Enumerator component to extend the Foreach Loop container so it can iterate over collections of items that the product doesn’t know about. For example, if you read data using some kind of proprietary method, you can use a custom Foreach Enumerator component to execute some control flow in a loop over each data element.

To create a custom Foreach Enumerator component, you follow the steps given earlier for creating a custom connection manager except your class should be derived from ForEachEnumeratorBase and the attribute on that class should be DtsForEachEnumerator. Copy the compiled assembly to %ProgramFiles%\Microsoft SQL Server\90\DTS\ForEachEnumerators.Summary.

Other  
  •  .NET Compact Framework 3.5 : Working with Data Sets (part 3) - Reading and Writing a Data Set as XML
  •  .NET Compact Framework 3.5 : Working with Data Sets (part 2) - Data Binding
  •  .NET Compact Framework 3.5 : Working with Data Sets (part 1) - Creating and Accessing DataSet, DataTable, and DataView Objects
  •  .NET Compact Framework 3.5 : Examining ADO.NET
  •  Using SQL Server 2005 Integration Services : Programming Integration Services (part 4) - Connecting the Source and Destination Adapters with a Path
  •  Using SQL Server 2005 Integration Services : Programming Integration Services (part 3) - Setting Up Column Information
  •  Using SQL Server 2005 Integration Services : Programming Integration Services (part 2)
  •  Using SQL Server 2005 Integration Services : Programming Integration Services (part 1) - Creating Packages Programmatically - Data Flow
  •  Using SQL Server 2005 Integration Services : Working with Integration Services Packages (part 2) - Data Flow
  •  Using SQL Server 2005 Integration Services : Working with Integration Services Packages (part 1) - Control Flow
  •  
    PS4 game trailer XBox One game trailer
    WiiU game trailer 3ds game trailer
    Top 10 Video Game
    -   Minecraft Mods - MAD PACK #10 'NETHER DOOM!' with Vikkstar & Pete (Minecraft Mod - Mad Pack 2)
    -   Minecraft Mods - MAD PACK #9 'KING SLIME!' with Vikkstar & Pete (Minecraft Mod - Mad Pack 2)
    -   Minecraft Mods - MAD PACK #2 'LAVA LOBBERS!' with Vikkstar & Pete (Minecraft Mod - Mad Pack 2)
    -   Minecraft Mods - MAD PACK #3 'OBSIDIAN LONGSWORD!' with Vikkstar & Pete (Minecraft Mod - Mad Pack 2)
    -   Total War: Warhammer [PC] Demigryph Trailer
    -   Minecraft | MINIONS MOVIE MOD! (Despicable Me, Minions Movie)
    -   Minecraft | Crazy Craft 3.0 - Ep 3! "TITANS ATTACK"
    -   Minecraft | Crazy Craft 3.0 - Ep 2! "THIEVING FROM THE CRAZIES"
    -   Minecraft | MORPH HIDE AND SEEK - Minions Despicable Me Mod
    -   Minecraft | Dream Craft - Star Wars Modded Survival Ep 92 "IS JOE DEAD?!"
    -   Minecraft | Dream Craft - Star Wars Modded Survival Ep 93 "JEDI STRIKE BACK"
    -   Minecraft | Dream Craft - Star Wars Modded Survival Ep 94 "TATOOINE PLANET DESTRUCTION"
    -   Minecraft | Dream Craft - Star Wars Modded Survival Ep 95 "TATOOINE CAPTIVES"
    -   Hitman [PS4/XOne/PC] Alpha Gameplay Trailer
    -   Satellite Reign [PC] Release Date Trailer
    programming4us
     
     
    programming4us