web analytics

Understanding Oracle Data Provider for .NET (ODP.NET)

Options

codeling 1602 - 6666
@2017-05-08 13:16:20

Oracle Data Provider for .NET (ODP.NET) is an implementation of a .NET data provider for Oracle Database, using and inheriting from classes and interfaces available in the Microsoft .NET Framework Class Library.

Following the .NET Framework, ODP.NET uses the ADO.NET model, which allows native providers to expose provider-specific features and data types. This is similar to Oracle Provider for OLE DB, where ADO (ActiveX Data Objects) provides an automation layer that exposes an easy programming model. ADO.NET provides a similar programming model, but without the automation layer, for better performance.

Oracle Data Provider for .NET uses Oracle native APIs to offer fast and reliable access to Oracle data and features from any .NET application. ODP.NET consists of two drivers: ODP.NET, Managed Driver and ODP.NET, Unmanaged Driver. ODP.NET, Managed Driver is a fully managed ADO.NET provider, consisting of fewer DLLs and smaller install size than ODP.NET, Unmanaged Driver. The managed driver has the same exact application programming interfaces (APIs) as ODP.NET, Unmanaged Driver. However, the managed driver's APIs are a subset of the Unmanaged Driver's APIs.

@2017-05-08 13:36:26

ODP.NET, Managed Driver is a fully managed provider version, which is 100% native .NET code. It includes nearly all the features of ODP.NET, Unmanaged Driver and uses the same application programming interface. This makes migrating existing ODP.NET applications to ODP.NET, Managed Driver easier.

With ODP.NET, Managed Driver, it is easier and faster to deploy ODP.NET. There are fewer assemblies, as few as one to deploy, which also makes patching straightforward, and the install size is smaller at less than 10 MB. Only one ODP.NET, Managed Driver assembly is necessary whether you are using 32-bit or 64-bit .NET Framework. Side-by-side deployment with other ODP.NET versions is simple since there are no unmanaged assemblies to account for. As a fully managed provider, ODP.NET can better integrate with Code Access Security and ClickOnce deployment.

@2017-05-25 15:49:11

Oracle Data Provider for .NET, Managed Driver Configuration

ODP.NET, Managed Driver supports .NET configuration file-based settings in machine.config, application.config, and web.config. It does not support Windows registry based configuration. ODP.NET, Managed Driver settings in .NET configuration files are similar to ODP.NET, Unmanaged Driver settings to make porting easier.

The ODP.NET, Managed Driver configuration file section name is <oracle.manageddataaccess.client> as compared to <oracle.dataaccess.client> in ODP.NET, Unmanaged Driver. A typical .NET config that uses ODP.NET, Managed Driver has some or all of the following subsections nested within a <version> subsection under <oracle.manageddataaccess.client> section. Note the tag names are case sensitive, while the attribute names are case insensitive.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
   <section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess" />
  </configSections>
  <oracle.manageddataaccess.client>
    <version number="*">
      <dataSources>
        ...
        ...
      </dataSources>
      <settings>
        ...
        ...
      </settings>
      <implicitRefCursor>
        ...
        ...
      </implicitRefCursor>
      <edmMappings>
        ...
        ...
      <edmMappings>
    </version>
    <version number="4.112.3.60">
      <dataSources>
        ...
        ...
      </dataSources>
      <settings>
        ...
        ...
      </settings>
      <implicitRefCursor>
        ...
        ...
      </implicitRefCursor>
      <edmMappings>
        ...
        ...
      <edmMappings>
    </version>
  </oracle.manageddataaccess.client>
</configuration>

The ODP.NET, Managed Driver configuration and settings are described in the following sections. Many of the attributes are the same as ODP.NET, Unmanaged Driver.

dataSources Section

This section can appear only under a <version> section. The mapping between the different data source aliases and corresponding data descriptors should appear in this section. The following is an example.

<dataSources>
  <dataSource alias="inst1" descriptor="(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=sales-server)......)))"/>
  <dataSource alias="inst2" descriptor="(DESCRIPTION= ......)))"/>
</dataSources>

The following precedence order is followed to resolve the data source alias specified in the Data Source attribute in the connection string.

  1. data source alias in the dataSources section under <oracle.manageddataaccess.client> section in the .NET config file.

  2. data source alias in the tnsnames.ora file at the location specified by TNS_ADMIN in the .NET config file.

  3. data source alias in the tnsnames.ora file present in the same directory as the .exe.

settings section

This section can appear only under a <version> section. Any ODP.NET, Managed Driver specific settings should appear in this section. The following is an example of a settings section:

<settings>
  <setting name="TraceLevel" value="7" />
  <setting name="TraceOption" value="1"/>
  <setting name="TNS_ADMIN" value="C:\oracle\work"/>
</settings>

ODP.NET, Managed Driver configuration settings that are supported:

  • DbNotificationPort

  • DemandOraclePermission

  • FetchSize

  • MaxStatementCacheSize

  • MetaDataXml

  • NAMES.DIRECTORY_PATH: The default search order is TNSNAMES and EZCONNECT. TNSNAMES, LDAP, and EZCONNECT are the only name resolution methods supported, but their precedence order can be modified.

  • NAMES.LDAP_AUTHENTICATE_BIND

  • NAMES.LDAP_CONN_TIMEOUT

  • NODELAY

  • ORACLE_SID

  • PerformanceCounters

  • SelfTuning

  • SQLNET.AUTHENTICATION_SERVICES : Only supported values are NTS and null, empty, or not-specified.

  • StatementCacheSize

  • SSL_VERSION

  • TNS_ADMIN : Location where either one or more of tnsnames.ora, ldap.ora, and sqlnet.ora are located.

  • TraceFileLocation : Trace file destination location. This is different from ODP.NET, Unmanaged Driver, which supports TraceFileName.

  • TraceLevel : 1 = public APIs; 2 = private APIs; 4 = network APIs/data. These values can be ORed. To enable everything, set TraceLevel to 7. Errors will always be traced.

  • TraceOption

  • TCP.CONNECT_TIMEOUT

  • WALLET_LOCATION : Microsoft Certificate Store (MCS) and file system wallets are supported

 

 

 

@2017-09-29 13:48:06

Pro ODP.NET for Oracle Database 11g

This book is a comprehensive and easy-to-understand guide for using the Oracle Data Provider (ODP) version 11g on the .NET Framework. It also outlines the core GoF (Gang of Four) design patterns and coding techniques employed to build and deploy high-impact mission-critical applications using advanced Oracle database features through the ODP.NET provider.

The book details the features of the ODP.NET provider in two main sections: “Basic,” covering the basics and mechanisms for data access via ODP.NET; and “Advanced,’ covering advanced Oracle features such as globalization, savepoints, distributed transactions and how to call them via ODP.NET, advanced queueing (AQ), and promotable transactions. It takes you from the ground up through different implementation scenarios via a rich collection of C# code samples.

It outlines database security and performance optimization tricks and techniques on ODP.NET that conform to best practices and adaptable design. Different GoF design patterns are highlighted for different types of ODP.NET usage scenarios with consideration of performance and security.

Comments

You must Sign In to comment on this topic.


© 2024 Digcode.com