I'm trying to learn and figure out if it is possible to deploy an MVC, EF, ODAC 11.2.0.3 app to a server that has a previous version of ODP.NET installed. Rather than updating the sever ODP.NET (which I can't), I figured I could use the Oracle Instant Client.
Is this doable?
1) I added these dlls to my project to support Instant Client
-Oracle.DataAccess.dll
-oci.dll
-ociw32.dll
-orannzsbb11.dll
-oraociei11.dll
-OraOps11w.dll
2) Next I updated web.config for the dbProviderFactories
<system.data>
<DbProviderFactories>
<add name="Oracle Data Provider for .NET"
invariant="Oracle.DataAccess.Client"
description="Oracle Data Provider for .NET"
type="Oracle.DataAccess.Client.OracleClientFactory, Oracle.DataAccess, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</DbProviderFactories>
</system.data>
3) This (afaik) is how to use the Oracle dll in the bin rathre than the GAC
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Oracle.DataAccess" publicKeyToken="89b483f429c47342" />
<publisherPolicy apply="no" />
</dependentAssembly>
</assemblyBinding>
</runtime>
4) Finally my connectionString
<connectionStrings>
<add name="Entities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=Oracle.DataAccess.Client;
provider connection string="DATA SOURCE=XXX;PASSWORD=XXX;PERSIST SECURITY INFO=True;USER ID=XXX"" providerName="System.Data.EntityClient" />
</connectionStrings>
This is the error I receive Unable to find the requested .Net Framework Data Provider. It may not be installed.
I really appreciate any help here. I'm rather new and have a lot to learn. Thanks in advance. cheers
In a Model-First scenario, a developer first creates an Entity Framework object-relational data model. From that data model, the developer can automatically generate an Oracle relational database model in the form of DDL scripts.
Go to a different directory from the one on which you installed Oracle's Instant Client and enter the following command: sqlplus scott@bigdb/tiger select user from dual; If this test is successful, you are ready to use the run-time.
Oracle client comes with an installer and a lot of executable like sqlplus, tnsping, it's complete and huge. Oracle Instant client is a basic lightweight client which can be unzipped in a location without any installation, it contains only the communication layer to be able to connect to oracle.
Oracle Instant Client enables development and deployment of applications that connect to Oracle Database, either on-premise or in the Cloud. The Instant Client libraries provide the necessary network connectivity and advanced data features to make full use of Oracle Database.
Add a <remove … />
section in the <DbProviderFactories>
element in the web config to remove any existing Oracle provider. (before the <add>
)
<remove invariant ="Oracle.DataAccess.Client" />
It seems from your question that you need to deploy an update to your application and the new version of ODP.net using only xcopy deployment permission.
Since your application is being changed, then you shouldn't need the assembly binding changes or DbProviderFactories. Just update the csproj of the class library with your edmx etc to have a reference to the new ODP.net version, eg
<Reference Include="Oracle.DataAccess, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=x86" />
If you get an issue with your tnsnames.ora, then you would have to do one of the following: a) Add a system environment variable TNS_ADMIN to point to the directory of the tnsnames.ora, or b) Change the connection string to something based on:
Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=MyOracleSID)));User Id=myUsername;Password=myPassword;
c) See if you can put a copy of the tnsnames.ora somewhere else.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With