C .NET Classes : DB2 Data Provider Classs

DB2 Data Provider Classs
The DB2 data provider supports the public classes, properties, and methods as described in the Microsoft .NET Framework SDK documentation. The DB2 data provider attaches the provider-specific prefix "DB2" to the public .NET classes, for example, DB2Command.
This section describes the provider-specific properties and methods of the DB2 data provider.
NOTE: This section applies to both DB2 data providers. See “Supported Properties and Methods” for information on the differences for the DB2 Entity Framework data provider.
DB2BulkCopy Class
The DB2BulkCopy class uses an API pattern similar to the ADO.NET Bulk API patterns, and has no provider-specific public properties or methods. For information about the properties and methods supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
DB2BulkCopyColumnMapping Class
The DB2BulkCopyColumnMapping class uses an API pattern similar to the ADO.NET Bulk API patterns, and has no provider-specific public properties or methods. For information about the properties and methods supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
DB2BulkCopyColumnMappingCollection Class
The DB2BulkCopyColumnMappingCollection class follows an API pattern similar to the Microsoft SqlBulkCopyColumnMappingCollection class, and has no provider-specific public properties or methods. For information about the properties and methods supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
DB2Command Class
Table C-2 lists the provider-specific public properties of the DB2Command class. The table includes the generic public properties of the Command class when provider-specific information supplements the standard descriptions. For information about other properties and methods supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
In this section, DB2Command instances are referred to as statements.
 
Table C-3 lists the generic public methods of the Command class when provider-specific information supplements the standard descriptions. For a description of the other methods supported, refer to the online help and the Microsoft .NET Framework SDK documentation.
 
DB2CommandBuilder Class
Using a CommandBuilder class can have a negative effect on performance. Because of concurrency restrictions, the CommandBuilder can generate highly inefficient SQL statements. The end user can often write more efficient UPDATE and DELETE statements than those that the CommandBuilder generates (refer to the DataDirect Connect Series for ADO.NET Reference for more information).
The DB2CommandBuilder class has no provider-specific public properties or methods. For information about the properties and methods supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
DB2Connection Class
Table C-4 lists the provider-specific public properties of the DB2Connection class. The table includes the generic public properties of the Connection class when provider-specific information supplements the standard descriptions.
 
See “Using Reauthentication” for a description of OS authentication in a connection pool.
See “Performance Considerations” for a discussion of the performance implications of the value set for this property.
Table C-5 lists the provider-specific public methods of the DB2Connection class. The table includes the generic public methods when provider-specific information supplements the standard descriptions. For information about other methods supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
 
See “Using Reauthentication” for a description of OS authentication in a connection pool.
Retrieves a set of statistics for a DB2Connection class that is enabled for statistics gathering (see the StatisticsEnabled property). The set of name=value pairs returned forms a "snapshot in time" of the state of the connection when the method is called.
The SetOEMLicenseInfo method is for Progress DataDirect OEM customers only. Refer to the DataDirect Connect Series for ADO.NET Distribution Guide for more information.
DB2ConnectionStringBuilder Class
TheDB2ConnectionStringBuilder class has no provider-specific public methods. For information about the methods supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
DB2ConnectionStringBuilder property names are the same as the connection string option names of the DB2Connection class. However, the connection string option name has spaces between the words. For example, the connection string option name Alternate Servers is equivalent to the property name AlternateServers.
See “DB2 Data Provider Connection String Options” for the connection option descriptions, which are listed alphabetically by the connection string option name. The ConnectionStringBuilder property name is listed immediately underneath the GUI name.
DB2DataAdapter Class
Table C-6 lists the provider-specific implementation of the public properties of the DB2DataAdapter class. For information about other properties and methods supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
 
The DB2ConnectionStringBuilder class has no provider-specific public methods. For a description of the methods supported by the ConnectionStringBuilder class, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
DB2DataReader Class
The DB2DataReader class has no provider-specific public properties. For information about the properties supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
Table C-7 lists the public methods of the DB2DataReader class that have provider-specific information. For a description of the other methods supported, refer to the online help and the Microsoft .NET Framework SDK documentation.
 
DB2Error Class
Table C-8 lists the provider-specific public properties of the DB2Error class. For information about other properties and methods supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
 
DB2ErrorCollection Class
Table C-9 lists the public, provider-specific properties of the DB2ErrorCollection class. For information about other properties and methods supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
 
DB2Exception Class
Provider-specific exceptions are derived directly from the System.Data interface. Only the public properties and methods, for example, the Message property, are directly available on the System.Exception object in a generic sense. The SQLState and Number properties are only accessible through provider-specific code or by using reflection.
ADO.NET 2.0 introduced the Data property on the DbException class. This property returns a collection of key-value pair tuples that provide additional user-defined information about an exception. The DB2 data provider gets a collection of key/value pairs such as SQLState, Number, and ErrorPosition.
The DDTek prefix is applied to each key, for example:
DDTek.Data["SQLState"] = 28000;
Table C-10 lists the provider-specific public properties of the DB2Exception class. The properties apply to the last error collected if multiple errors occurred. For information about other properties and methods supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
 
DB2Factory Class
Factory classes allow users to program to generic classes for the data provider. Once instantiated from DbProviderFactory, the factory generates the proper type of concrete class.
Table C-11 lists the static methods used to accommodate choosing a data provider and instantiating its DbProviderFactory.
 
DB2InfoMessageEventArgs Class
The DB2InfoMessageEventArgs class is passed as an input to the DB2InfoMessageEventHandler and contains information relevant to a warning generated by the DB2 server.
The DB2InfoMessageEventArgs class has no provider-specific public properties or methods. For information about the properties and methods supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
DB2Parameter Class
Table C-12 lists the provider-specific public properties of the DB2Parameter class. The table includes the generic public properties of the Parameter class when provider-specific information supplements the standard descriptions. For information about other properties and methods supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
NOTE: When executing a stored procedure, the data provider by default assumes that the parameters supplied are in the same order as they were specified in the Create Procedure statement. The names of parameters supplied in the DB2Parameter class are ignored.
 
This property is specified as an array of values when array binding is enabled (see the ArrayBindCount property of the “DB2Command Class”). Each array's length must match the value of the ArrayBindCount property. When specifying the array's values for binary type columns, the data will actually be specified as byte[]. This is an array of arrays of bytes. The data provider anticipates a jagged array as such when using parameter array binding with parameters.
DB2ParameterCollection
Table C-13 lists the provider-specific public properties of the DB2Parameter class. For information about other properties supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
 
DB2Trace Class
Setting the properties in the DB2Trace class overrides the settings of the environment variables (see “Using Environment Variables”). For your final application, be sure to remove references to the DB2Trace class.
The following code fragment creates a DB2Trace class named MyTrace.txt. All subsequent calls to the data provider will be traced to that file.
DB2Trace.TraceFile="C:\\MyTrace.txt";
DB2Trace.RecreateTrace = 1;
DB2Trace.EnableTrace = 1;
Table C-14 lists the public properties of the DB2Trace class.
 
Table C-15 lists the public methods of the DB2Trace class.
 
DB2Transaction Class
The DB2Transaction class has no provider-specific public properties or methods. For a description of the properties and methods supported, refer to the online help and the Microsoft .NET Framework SDK documentation.