# Oracle Data Provider for .NET

Release Notes

Release 12.1.0.2.0 for ODAC 12c Release 3

#### December 2014

#### Copyright (c) Oracle Corporation 2014

This document provides information that supplements the Oracle Data Provider for .NET (ODP.NET) documentation.

## TABLE OF CONTENTS

- Documentation Corrections and Additions
- ODP.NET, Managed Driver Tips, Limitations, and Known Issues
- ODP.NET, Unmanaged Driver Tips, Limitations, and Known Issues
- Entity Framework Tips, Limitations, and Known Issues

## Documentation Corrections and Additions

This section contains information that corrects or adds to existing ODP.NET documentation.
Custom Entity Data Model (EDM) Type Mapping Not Applied to Generated Complex Types
When using the EDM wizard to create a complex type from a function import, any custom EDM type mappings specified will not be applied. The EDM wizard uses the default type mappings and the only known workaround is to manually edit the resulting complex type. After the complex type is generated any type declaration (field, property, constructor parameter, etc.) in the complex object which has an undesired type (such as Decimal rather than Boolean) should be manually edited to be of the desired type.
ODP.NET Configuration Files: Unified Managed and Unmanaged ODP.NET Format
ODP.NET, Unmanaged Driver now has the option of using the same configuration file format as ODP.NET, Managed Driver. The format simplifies configuration by using a single unified scheme. To utilize this format, the existing unmanaged ODP.NET configuration section should be renamed from <oracle.dataaccess.client> to <oracle.unmanageddataaccess.client>. The existing unmanaged ODP.NET elements and values are supported within the new section using the same format as with ODP.NET, Managed Driver. For example, converting the FetchSize element and value from the traditional to the new format would be done as follows:

<oracle.dataaccess.client>
<settings>
<add name="FetchSize" value="131072" />
</settings>
</oracle.dataaccess.client>

<oracle.unmanageddataaccess.client>
<version number="*">
<settings>
setting name="FetchSize" value="131072" />
</settings>
</version>
</oracle.unmanageddataaccess.client>
Specifying UDT Mappings with Unified Configuration for Unmanaged ODP.NET
To support custom UDT mappings in the unified configuration format, a new section within the <version> section is used. This new section is identified as <udtmappings> and each mapping is identified using a <udtmapping> element. The following attributes may be specified for each udtMapping element:
- typeName (required)
- factoryName (required)
- dataSource (optional)
- schemaName (optional)
These elements retain the same name and meaning as when used with the traditional configuration format. For additional information refer to the Oracle User-Defined Types (UDTs) and .NET Custom Types chapter in the Oracle Data Provider for .NET Developer's Guide.
Example of converting traditional format to unified format:
<configuration>
<oracle.dataaccess.client>
<settings>
<add name="Person" value="udtMapping factoryName='PersonFactory, Sample, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' typeName='PERSON' schemaName='SCOTT' dataSource='oracle'" />
</settings>
</oracle.dataaccess.client>
</configuration>
<configuration>
<oracle.unmanageddataaccess.client>
<udtmappings>
<udtmapping typename="PERSON" factoryname="PersonFactory, Sample, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null" schemaname="SCOTT" datasource="oracle" />
</udtmappings>
</oracle.unmanageddataaccess.client>
</configuration>
Note: UDT mapping does not apply to the ODP.NET, Managed Driver.
ODP.NET, Managed Driver Support for Oracle Database 12c Implicit Ref Cursor
ODP.NET, Managed Driver introduces support for the new Oracle Database 12c Implicit Ref Cursor. Configuration occurs using the <implicitrefcursor> .NET configuration section. When using database implicit ref cursors, the bindInfo element should be specified with a mode of "Implicit":
<bindinfo mode="Implicit" />
For additional information refer to the implicitRefCursor section in Chapter 2 of the Oracle Data Provider for .NET Developer's Guide.
Entity Framework Code First: Code-Based Migrations With No Supporting Code Migration File
When using code-based migrations with the Entity Framework provider, the migration history table may be dropped if no supporting code migration file existed prior to updating the database.
Workaround: Ensure the supporting code migration file has been added prior to updating the database.
The following steps can remove the migration history table:

1. Execute application to create database objects
2. Enable-Migrations
3. Make code change to POCO
4. Update-Database

The workaround is to ensure code file is created:

1. Execute application to create database objects
2. Enable-Migrations
3. Make code change to POCO
4. Add-Migration (This step will create the necessary code migration file).
5. Update-Database

Session Time Zone Hour Offset in ODP.NET Managed and Unmanaged Drivers
ODP.NET managed and unmanaged drivers set the default session time zone differently. While the session time zone for unmanaged ODP.NET uses an hour offset, managed ODP.NET uses the region identifier for setting its session time zone. As a result, managed ODP.NET is sensitive to daylight savings in scenarios where the timestamp LTZ values have to be converted from/to the session time zone.
There are two methods to resolve this difference if needed. For ODP.NET, Unmanaged Driver, the application explicitly sets the region identifier with the environment variable 'ORA_SDTZ' (e.g. 'set ORA_SDTZ = <Region ID>'). If ORA_SDTZ variable is set, Oracle Client considers this value as the session time zone. The second method is to execute an alter session command to set the session time zone property to the region identifier.
ODP.NET, Managed Driver with NTS Authentication
ODP.NET, Managed Driver supports NTS authentication to the database, except when the Windows domain is constrained to only support Kerberos-based domain authentication.
ODP.NET, Managed Driver SSL Connections with Firewalls
ODP.NET, Managed Driver SSL connections require a redirect to a dynamic port on the database server side. If a firewall exists between the database client and server, then all firewall ports must be enabled or the dynamic firewall port Oracle chooses must be enabled at run-time.

## ODP.NET, Managed Driver Tips, Limitations, and Known Issues

This section contains information that is specific to ODP.NET, Managed Driver.

1. OracleConnection object's OpenWithNewPassword() method invocation will result in an ORA-1017 error with 11.2.0.3.0 and earlier versions of the database. [Bug 12876992]
2. Stored functions/procedures in a PDB cannot be added to a .NET Entity Framework model. [Bug 17344899]

## ODP.NET, Unmanaged Driver Tips, Limitations, and Known Issues

This section contains information that is specific to ODP.NET, Unmanaged Driver.

1. If SenderId is specified in OracleAQMessage object while enqueuing, the sender id of dequeued message will have "@ODP.NE" appended in the end. [Bug 7315542]
2. An "ORA-00942: table or view does not exist" error may be thrown from Dequeue or DequeueArray method invocations when OracleAQDequeueOptions.DeliveryMode is specified as OracleAQMessageDeliveryMode.Buffered and OracleAQDequeueOptions.Correlation is specified and there are no messages available in the queue. [Bug 7343633]
3. Applications may not receive group notifications if GroupingInterval property on the OracleNotificationRequest object is set to 0. [Bug 7373765]
4. OracleConnection object's OpenWithNewPassword() method invocation will result in an ORA-1017 error with pre-11.2.0.3.0 database versions. [Bug 12876992]

## Entity Framework Tips, Limitations, and Known Issues

This section contains Entity Framework related information that pertains to both ODP.NET, Managed Driver and ODP.NET, Unmanaged Driver.

1. Interval Day to Second and Interval Year to Month column values cannot be compared to literals in a WHERE clause of a LINQ to Entities or an Entity SQL query.
2. LINQ to Entities and Entity SQL (ESQL) queries that require the usage of SQL APPLY in the generated queries will cause SQL syntax error(s) if the Oracle Database being used does not support APPLY. In such cases, the inner exception message will indicate that APPLY is not supported by the database.
3. ODP.NET does not currently support wildcards that accept character ranges for the LIKE operator in Entity SQL (i.e. [] and [^]). [Bug 11683837]
4. Executing LINQ or ESQL query against tables with one or more column names that are close to or equal to the maximum length of identifiers (30 bytes) may encounter "ORA-00972: identifier is too long" error, due to the usage of alias identifier(s) in the generated SQL that exceed the limit.
5. An "ORA-00932: inconsistent datatypes: expected - got NCLOB" error will be encountered when trying to bind a string that is equal to or greater than 2,000 characters in length to an XMLType column or parameter. [Bug 12630958]
6. An "ORA-00932 : inconsistent datatypes" error can be encountered if a string of 2,000 or more characters, or a byte array with 4,000 bytes or more in length, is bound in a WHERE clause of a LINQ/ESQL query. The same error can be encountered if an entity property that maps to a BLOB, CLOB, NCLOB, LONG, LONG RAW, XMLTYPE column is used in a WHERE clause of a LINQ/ESQL query.
7. An "Arithmetic operation resulted in an overflow" exception can be encountered when fetching numeric values that have more precision than what the .NET type can support. In such cases, the LINQ or ESQL query can "cast" the value to a particular .NET or EDM type to limit the precision and avoid the exception. This approach can be useful if the LINQ/ESQL query has computed/calculated columns which will store up to 38 precision in Oracle, which cannot be represented as .NET decimal unless the value is casted.
8. Oracle Database treats NULLs and empty strings the same. When executing string related operations on NULLS or empty strings, the result will be NULL. When comparing strings with NULLs, use the equals operator (i.e. "x == NULL") in the LINQ query, which will in turn use the "IS NULL" condition in the generated SQL that will appropriately detect NULL-ness.
9. If an exception message of "The store provider factory type 'Oracle.ManagedDataAccess.Client.OracleClientFactory' does not implement the IServiceProvider interface." is encountered when executing an Entity Framework application with ODP.NET, the machine.config requires and entry for ODP.NET under the <DbProviderFactories> section. To resolve this issue by adding an entry in the machine.config, reinstall ODAC.
10. Creating a second instance of the context that derives from DbContext within an application and executing methods within the scope of that context that result in an interaction with the database may result in unexpected recreation of the database objects if the DropCreateDatabaseAlways database initializer is used.
    More Information: https://entityframework.codeplex.com/workitem/2362
    Known Workarounds:
    - Use a different database initializer,
    - Use an operating system authenticated user for the connection, or
    - Include "Persist Security Info=true" in the connection string (Warning: Turning on "Persist Security Info" will cause the password to remain as part of the connection string).
11. Deinstallation of ODP.NET versions that are prior to ODAC 12c Release 3 production can cause entries with .NET 2.x assembly references to be entered in the .NET 4.0 machine.config. This can cause side-by-side execution errors unless config section entry for "oracle.unmanageddataaccess.client" that references 2.x version of Oracle.DataAccess.Client is manually removed from the .NET 4.0 machine.config. It is also advised that a DbProviderFactories entry that references 2.x version of Oracle.DataAccess.Client be removed manually as well.