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
  •  SQL Server 2005 : Extending Your Database System with Data Mining - Data Mining Applied (part 2)
  •  SQL Server 2005 : Extending Your Database System with Data Mining - Data Mining Applied (part 1)
  •  # Oracle Coherence 3.5 : Achieving Performance, Scalability, and Availability Objectives (part 2)
  •  # Oracle Coherence 3.5 : Achieving Performance, Scalability, and Availability Objectives (part 1)
  •  MySQL Server Monitoring (part 3) - Server Logs, Third-Party Tools & The MySQL Benchmark Suite
  •  MySQL Server Monitoring (part 2) - MySQL Administrator
  •  MySQL Server Monitoring (part 1) - SQL Commands
  •  Using MySQL Enterprise (part 3) - Query Analyzer
  •  Using MySQL Enterprise (part 2) - Monitoring
  •  Using MySQL Enterprise (part 1) - Installation & Fixing Monitoring Agent Problems
  •  
    Most View
    Windows Server 2003 : Implementing a GPO (part 2) - Modifying a GPO
    The Best Entry Level Phones – November 2012 (Part 5)
    Online Critiquing (Part 1)
    How Much Watts Do You Need (Part 4) : LEPA G850, Astro PT 700W, Desert Fox Commander III 800w
    Ten Popular Open Source Media Players
    Windows Vista : Scripting and Automation - Object References (part 2) - How to Use the Network, How to Control Internet Explorer, How to Use Command-Line Parameters
    SSD Redefined
    Find Yourself With Geolocation Technology (Part 1)
    Google Maps – It’s Pretty Much Perfect In Every Way
    Top 10 Headphones - Jan 2013
    Top 10
    G-360 And G-550 Power Supply Devices Review (Part 4)
    G-360 And G-550 Power Supply Devices Review (Part 2)
    Canon IXUS 140 Camera - Great Color Reproduction
    Nikon Coolpix S5200 Camera - 10fps Continuous Shooting Mode
    Corsair Neutron GTX 240GB - A Fast Performing SSD
    G-360 And G-550 Power Supply Devices Review (Part 3)
    G-360 And G-550 Power Supply Devices Review (Part 1)
    OCZ Vector 256GB - One Of The Dominant Names In SSD
    Don’t Pay For Office 2013 (Part 2)
    Don’t Pay For Office 2013 (Part 1)