Skip Headers
Oracle® Data Provider for .NET Developer's Guide
11g Release 1 (11.1)

Part Number B28375-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

ODP.NET Configuration

Starting with ODP.NET 11.1, Oracle Data Provider for .NET reads config files for ODP.NET configuration settings. The registry entries remain to be used as machine-wide settings for a particular version of ODP.NET. However, the configuration settings in the machine.config are used as .NET framework-wide settings that override the registry values. The application or web config file is an application-specific setting that overrides the machine.config setting (and also overrides the registry).

The application or web config file can be useful and sometimes essential in scenarios where more than one application on a computer use the same version of ODP.NET, but each application needs a different ODP.NET configuration. The registry value settings for a given version of ODP.NET affect all the applications that use that version of ODP.NET. However, having ODP.NET configuration values in the application or web config file assure that these settings are applied only for that application, thus providing more granularity.

For example, if the application or web.config has a configuration setting of StatementCacheSize of 100, such application-specific settings force the version of ODP.NET that is loaded by that application to use 100 for the StatementCacheSize and override any setting in the machine.config and in the registry. Note that for any setting that does not exist in a config file (machine.config or application/web config), the value in the registry for a loaded version of ODP.NET is used, as in previous releases.

Note that ODP.NET reads the machine.config files from the version of the .NET Framework in which ODP.NET runs, not from the version of ODP.NET.

The following is a sample application config for .NET Framework 1.x applications that overrides all the registry settings:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <oracle.dataaccess.client> 
    <add key="DllPath" value="C:\app\user\product\11.1.0\client_1\BIN"/>
    <add key="FetchSize"          value="65536"/>
    <add key="StatementCacheSize" value="10"/>
    <add key="TraceFileName"      value="c:\odpnet1.trc"/>
    <add key="TraceLevel"         value="0"/>
    <add key="TraceOption"        value="0"/>
  </oracle.dataaccess.client>
</configuration>

The following is a sample application config for .NET Framework 2.0 applications that overrides all the registry settings. Note that the sample also demonstrates how to have a provider factory entry that is specific for the application, which references version 2.111.6.0 of ODP.NET:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.data>
    <DbProviderFactories>
      <add name="Oracle Data Provider for .NET Version 11.1.0.6.0"
           invariant="Oracle.DataAccess.Client Version 11.1.0.6.0"
           description="Oracle Data Provider for .NET Version 11.1.0.6.0"
           type="Oracle.DataAccess.Client.OracleClientFactory, Oracle.DataAccess,
           Version=2.111.6.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
    </DbProviderFactories>
  </system.data>
  <oracle.dataaccess.client>
    <settings>
      <add name="DllPath" value="C:\app\user\product\11.1.0\client_1\BIN"/>
      <add name="FetchSize"             value="65536"/>
      <add name="PromotableTransaction" value="promotable"/>
      <add name="StatementCacheSize"    value="10"/>
      <add name="TraceFileName"         value="c:\odpnet2.trc"/>
      <add name="TraceLevel"            value="0"/>
      <add name="TraceOption"           value="0"/>
    </settings>
  </oracle.dataaccess.client>
</configuration>