Table of Contents

Class DB2ConnectionDataProvider

Namespace
combit.Reporting.DataProviders
Assembly
combit.ListLabel31.CrossPlatform.dll
[Serializable]
public sealed class DB2ConnectionDataProvider : DbConnectionDataProvider, IDataProvider, ICanHandleUsedIdentifiers, IDisposable, ISupportsLogger, ISerializable
Inheritance
DB2ConnectionDataProvider
Implements
Inherited Members

Examples

The following example demonstrates how to use the DB2ConnectionDataProvider to export a report to PDF:

// Example 1: Basic connection with connection string
DB2ConnectionDataProvider provider = new DB2ConnectionDataProvider(
    "Server=myDB2Server:50000;Database=SAMPLE;UID=myuser;PWD=mypassword;");

// Create a ListLabel reporting engine instance and assign the provider as the data source.
using ListLabel listLabel = new ListLabel();
listLabel.DataSource = provider;

// Configure export settings to generate a PDF.
ExportConfiguration exportConfiguration = new ExportConfiguration(LlExportTarget.Pdf, exportFilePath, projectFilePath);
exportConfiguration.ShowResult = true;

// Export the report to PDF.
listLabel.Export(exportConfiguration);

// Example 2: Connection with specific schema filtering
DB2ConnectionDataProvider schemaProvider = new DB2ConnectionDataProvider(
    "Server=myDB2Server:50000;Database=SAMPLE;UID=myuser;PWD=mypassword;",
    "MYSCHEMA");

// Example 3: Connection with multiple schemas
List<string> schemas = new List<string> { "SCHEMA1", "SCHEMA2", "SCHEMA3" };
DB2ConnectionDataProvider multiSchemaProvider = new DB2ConnectionDataProvider(
    "Server=myDB2Server:50000;Database=SAMPLE;UID=myuser;PWD=mypassword;",
    schemas.AsReadOnly());

// Example 4: Configure table name prefixing with schema
DB2ConnectionDataProvider prefixedProvider = new DB2ConnectionDataProvider(
    "Server=myDB2Server:50000;Database=SAMPLE;UID=myuser;PWD=mypassword;");
prefixedProvider.PrefixTableNameWithSchema = true;

// Example 5: Filter to only tables (exclude views)
DB2ConnectionDataProvider tablesOnlyProvider = new DB2ConnectionDataProvider(
    "Server=myDB2Server:50000;Database=SAMPLE;UID=myuser;PWD=mypassword;");
tablesOnlyProvider.SupportedElementTypes = DbConnectionElementTypes.Table;

Remarks

The DB2ConnectionDataProvider class extends DbConnectionDataProvider to provide connectivity to IBM DB2 databases using the IBM.Data.DB2 ADO.NET provider. It supports tables and views with schema-based filtering, automatically retrieves foreign key relationships, and handles composite primary keys. The provider queries DB2's system catalog tables (SYSCAT) to discover database metadata and relationships. It supports custom filter syntax translation for List & Label expressions, converting them to DB2-compatible SQL syntax. Schema filtering allows limiting data access to specific database schemas, excluding system schemas by default (SYSTOOLS, SYSIBM, SYSCAT, SYSSTAT, SYSIBMADM). The provider provides native aggregate function mapping for DB2-specific functions.

Constructors

DB2ConnectionDataProvider(string)

Initializes a new instance of the DB2ConnectionDataProvider class using the specified connection string.

public DB2ConnectionDataProvider(string connectionString)

Parameters

connectionString string

The connection string for the DB2 database.

DB2ConnectionDataProvider(string, ReadOnlyCollection<string>)

Initializes a new instance of the DB2ConnectionDataProvider class using the specified connection string and table schemas.

public DB2ConnectionDataProvider(string connectionString, ReadOnlyCollection<string> tableSchemas)

Parameters

connectionString string

The connection string for the DB2 database.

tableSchemas ReadOnlyCollection<string>

A read-only collection of table schemas to include.

DB2ConnectionDataProvider(string, string)

Initializes a new instance of the DB2ConnectionDataProvider class using the specified connection string and a single table schema.

public DB2ConnectionDataProvider(string connectionString, string tableSchema)

Parameters

connectionString string

The connection string for the DB2 database.

tableSchema string

The table schema to include.

Properties

PrefixTableNameWithSchema

Gets or sets a value indicating whether to prefix table names with their schema.

public bool PrefixTableNameWithSchema { get; set; }

Property Value

bool

SupportedElementTypes

Gets or sets the supported DbConnectionElementTypes for the database connection.

public DbConnectionElementTypes SupportedElementTypes { get; set; }

Property Value

DbConnectionElementTypes

Remarks

This property indicates which element types (tables, views) are supported by this data provider.

SupportsAdvancedFiltering

Gets or sets a value indicating whether advanced filtering is supported by the data provider.

public override bool SupportsAdvancedFiltering { get; set; }

Property Value

bool

Methods

GetNativeAggregateFunctionName(NativeAggregateFunction)

Gets the native aggregate function name for the specified aggregate function.

protected override string GetNativeAggregateFunctionName(NativeAggregateFunction functionInstance)

Parameters

functionInstance NativeAggregateFunction

The native aggregate function.

Returns

string

The corresponding DB2 aggregate function name.

Init()

Initializes the data provider by retrieving table and relation metadata from the DB2 database.

protected override void Init()

OnTranslateFilterSyntax(object, TranslateFilterSyntaxEventArgs)

Raises the TranslateFilterSyntax event.

protected override void OnTranslateFilterSyntax(object sender, TranslateFilterSyntaxEventArgs e)

Parameters

sender object

The source of the event.

e TranslateFilterSyntaxEventArgs

A TranslateFilterSyntaxEventArgs that contains the event data.