Represents a set of methods for creating instances of the System.Data.Common data source classes for the IBM® Data Server Provider for .NET.
System.Object
System.Data.Common.DbProviderFactory
IBM.Data.DB2.DB2Factory
[Visual Basic]
Public NotInheritable Class DB2Factory
Inherits DbProviderFactory
[C#]
public sealed class DB2Factory : DbProviderFactory
[C++]
public ref class DB2Factory sealed : public DbProviderFactory
[JScript]
public final class DB2Factory extends DbProviderFactory
[C#] The following example demonstrates the creation of a DbConnection instance, using the DB2Factory.CreateConnection method.
[C#]
DB2Factory myFactory = DB2Factory.Instance;
DbConnection conn = myFactory.CreateConnection();
[C#] You can also get a database factory instance by using the generic DbProviderFactories class. In the following example, which accomplishes the same task as the previous example, note the "IBM.Data.DB2" string passed to the GetFactory method. This string uniquely identifies the IBM Data Server Provider for .NET from all other .NET data providers.
[C#]
DbProviderFactory myFactory = DbProviderFactories.GetFactory("IBM.Data.DB2");
DbConnection conn = myFactory.CreateConnection();
Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.