I'm trying to switch my .NET project over to the manage oracle to make deployments easier. However I'm getting the following error in my test Win Server 2013 environment:
Unable to determine the provider name for connection of type 'Oracle.ManagedDataAccess.Client.OracleConnection'.
Steps I've taken so far:
- Removed all Oracle.DataAccess dll's and references from the solution
- Added the Oracle Data Provider for .NET (ODP.NET) Managed Driver in the NuGet package manager
- Switched all
Imports Oracle.DataAccess
statements over toImports Oracle.ManagedDataAccess
I'm not getting any build errors, and the project runs fine locally. However when deployed to the testing environment, I get this error. The test environment is Windows Server 2012, and has a legacy Oracle 11.2.0 client tools installation present.
This is my connection creation code:
Public Sub New()
MyBase.New(
New OracleConnection(
ConfigurationManager.ConnectionStrings("Entities").ConnectionString),
True)
End Sub
Here are 3 different styles of connection configs that I have tried (both work locally, but yield the same problem on the test environment)
(formatted for visibility)
<add
name="Entities"
connectionString="
Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=###.###.###.###)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=______)));
User Id=_____;
Password=_____;"
providerName="Oracle.ManagedDataAccess.Client" />
<add
name="Entities"
connectionString="
Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=###.###.###.###)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=______)));
User Id=_____;
Password=_____;"
providerName="Oracle.DataAccess.Client" />
<add
name="Entities"
connectionString="
Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=###.###.###.###)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=______)));
User Id=_____;
Password=_____;"
/>
Any help would be greatly appreciated!
Unofficial NuGet Method
To use Managed Oracle Data Access with Entity Framework, in Visual Studio 2012 (.NET 4.5):
Pull down Entity Framework 5.0.0.0
Install-Package EntityFramework -Version 5.0.0
Pull down Oracle Data Provider for .NET (ODP.NET) Managed Driver
Install-Package odp.net.managed
Add this section to the config file
And then proceed as usual. It appears at this time that Entity Framework 6 does not support Oracle.ManagedDataAccess yet, so it is necessary to run version 5.
Also keep in mind that if you are using Visual Studio 2010 or earlier, targeting .NET 4, NuGet will pull down EF5, but use the 4.x assemblies. I have not tested this on VS2010 with .NET 4.
Manual Download Method
Thanks to @Christian Shay for pointing out that the NuGet version of Managed ODAC is not authored by Oracle
To use Managed Oracle Data Access with Entity Framework, in Visual Studio 2012 (.NET 4.5):
Pull down Entity Framework 5.0.0.0
Install-Package EntityFramework -Version 5.0.0
Download the latest Oracle Data Access Components (ODAC)
Manually reference
Oracle.ManagedDataAccess.dll
Add this section to the config file
And then proceed as usual. It appears at this time that Entity Framework 6 does not support Oracle.ManagedDataAccess yet, so it is necessary to run version 5.
Also keep in mind that if you are using Visual Studio 2010 or earlier, targeting .NET 4, NuGet will pull down EF5, but use the 4.x assemblies. I have not tested this on VS2010 with .NET 4.