C .NET Classes : Oracle Data Provider Classs

Oracle Data Provider Classs
The Oracle data provider supports the public classes, properties, and methods as described in the Microsoft .NET Framework SDK documentation. The Oracle data provider attaches the provider-specific prefix "Oracle" to the public .NET classes, for example, OracleCommand.
This section describes the provider-specific properties and methods of the Oracle data provider.
NOTE: This section applies to both Oracle data providers. See “Supported Properties and Methods” for information on the differences for the Oracle Entity Framework data provider.
OracleBulkCopy
The OracleBulkCopy class uses a model similar to the Microsoft SqlBulkCopy class, and has no provider-specific 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.
OracleBulkCopyColumnMapping
The OracleBulkCopyColumnMapping class uses an API pattern similar to the ADO.NET Bulk API patterns, and has no provider-specific 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.
OracleBulkCopyColumnMappingCollection
The OracleBulkCopyColumnMappingCollection class follows an API pattern similar to the Microsoft SqlBulkCopyColumnMappingCollection class, and has no provider-specific 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.
OracleCommand Class
Table C-16 lists the provider-specific public properties of the OracleCommand 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.
 
OracleCommandBuilder 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.
For information about the properties supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
Table C-17 lists the provider-specific public methods of the OracleCommandBuilder class. For a description of the other methods supported, refer to the online help and the Microsoft .NET Framework SDK documentation.
 
OracleConnection Class
Table C-18 lists the provider-specific public properties of the OracleConnection class. Some properties return the values specified for the corresponding connection string option. See “Connection String Options” for more information. For a description of other properties supported, refer to the online help and the Microsoft .NET Framework SDK documentation.
 
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-19 lists the provider-specific public methods of the OracleConnection class. For a description of the other methods supported, refer to the online help and the Microsoft .NET Framework SDK documentation.
 
Retrieves a set of statistics for a connection 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.
OracleConnectionFactory Class
The data provider implements IDbConnectionFactory by a class named OracleConnectionFactory. This class allows you to use the OracleEntity provider as the default data provider using the Database.DefaultConnectionFactory property. The OracleConnectionFactory class provides support for passing a connection string to the DbContext constructor. Because Oracle does not support multiple databases, OracleConnectionFactory cannot pass a database name.
The following code snippet shows how the OracleConnectionFactory class can be used:
Database.DefaultConnectionFactory = new OracleConnectionFactory();
EF41SampleContext context = new EF41SampleContext("Host=nc-colts;
Password=TEST38; Port=1521; SID=CP871; User ID=TEST38");
context.Pocos.Add(poco);
context.SaveChanges();
Note that if a connectionString was passed into the DbContext constructor as in the example, the Entity Framework would attempt to create a new SqlCeConnection using the connection string. By setting the DefaultConnectionFactory to an OracleConnectionFactory instance, the Entity Framework will instead use an OracleConnection.
The OracleConnectionFactory also lets you specify a "base" connectionString to use which may act as a default connection string.
The OracleConnectionFactory class has no provider-specific public methods or properties. For information about the IDbConnectionFactory class, refer to the Microsoft .NET Framework SDK documentation.
OracleConnectionStringBuilder Class
TheOracleConnectionStringBuilder 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.
OracleConnectionStringBuilder property names are the same as the connection string option names of the OracleConnection 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 “Oracle 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.
OracleDataAdapter Class
Table C-20 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.
 
If your application 1) uses batch operations for inserts, updates, or deletes and 2) performs these operations on many values in the same columns, the data provider can use array binding to optimize batch updates. In this case, set the Batch Update Behavior connection string option to ArrayBindWhenPossible. If your application 1) uses batch operations for inserts only and 2) inserts many values in the same columns, the data provider can use array binding to optimize batch inserts. Set this option to ArrayBindOnlyInserts.
OracleDataReader Class
The OracleDataReader class has no provider-specific properties. For a description of the properties supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
Table C-21 lists the public methods of the OracleDataReader 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.
 
OracleError Class
Table C-22 lists the provider-specific public properties of the OracleError class. For information about other properties and methods supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
 
OracleErrorCollection Class
Table C-23 lists the provider-specific public properties of the ErrorCollection class. For information about other supported properties, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
 
OracleException 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 Oracle 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-24 lists the provider-specific public properties of the OracleException class. The properties apply to the last error generated, if multiple errors exist. See “OracleErrorCollection Class” for more information. For information about other properties and methods supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
OracleFactory Class
Provider Factory classes allow users to program to generic objects. Once instantiated from DbProviderFactory, the factory generates the proper type of concrete class.
Table C-25 lists the static methods used to accommodate choosing the Oracle data provider and instantiating its DbProviderFactory.
 
OracleInfoMessageEventArgs Class
The OracleInfoMessageEventArgs class is passed as an input to the OracleInfoMessageEventHandler and contains information relevant to a warning generated by the Oracle server.
The OracleInfoMessageEventArgs class has no provider-specific 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.
OracleParameter Class
Table C-26 lists the provider-specific public properties of the OracleParameter 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.
When the UseNamedParameters property of the OracleCommand class is set to True, the Oracle data provider uses the names of parameters supplied in the OracleParameter objects for the parameter binding to the Oracle server. See “OracleCommand Class” for more information.
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 OracleParameter object are ignored.
 
When array binding is enabled (see the ArrayBindCount property of the “OracleCommand Class”), this property is specified as an array of values. 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.
OracleParameterCollection
Table C-27 lists the provider-specific public properties of the OracleParameterCollection class. The table includes the generic public properties of the ParameterCollection class when provider-specific information supplements the standard descriptions. For a description of other properties and methods supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
 
OracleTrace Class
The OracleTrace class is created by the application to debug problems during development. Setting the properties in the OracleTrace class overrides the settings of the environment variables. See “Tracing Method Calls” for more information. For your final application, be sure to remove references to the OracleTrace class.
The following code fragment creates an OracleTrace object named MyTrace.txt. All subsequent calls to the data provider will be traced to that file.
OracleTrace.TraceFile="C:\\MyTrace.txt";
OracleTrace.RecreateTrace = 1;
OracleTrace.EnableTrace = 1;
Table C-28 lists the public properties for the OracleTrace class.
 
OracleTransaction Class
The OracleTransaction class has no provider-specific properties or methods. For a description of the properties and methods supported, refer to the online help and the Microsoft .NET Framework SDK documentation.