1

I´ve searched the following links:

How to deploy Oracle with EF

Problems deploying Oracle with EF

And many other posts around regarding Oracle deployment.

Basically I have an C# simple test application to insert some rows into a database (this is a test application. The full application uses a lot of EF stuff):

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Diagnostics;
using MzDbLib.DataAccessObject;
using MzDbLib.DatabaseContext;
using MzDbLib.DatabaseModel;

namespace TestDbConnection
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("This program will generate 10 logs into SYSTEMDATALOG table");

            ///
            /// Do a loop of 10 logs generated
            /// 
            for (int i = 0; i < 10; i++)
            {
                string msg = "TEST GENERATED LOG NUMBER " + i.ToString();

                Console.Write("Generating log " + i.ToString() + "...");

                //
                // Connect to database and to the log table
                //
                Entities dbContext = new Entities();
                SYSTEMDATALOG logTable = new SYSTEMDATALOG();

                logTable.DATETIME = DateTime.Now;

                logTable.TYPE = "INFO";

                logTable.SEVERITY = 0;
                logTable.SOURCE = "TESTDBCONNECTION";
                logTable.USER = "SYSTEM";
                logTable.MESSAGE = msg;

                dbContext.SYSTEMDATALOG.Add(logTable);
                dbContext.SaveChanges();

                Console.WriteLine("Done.");
            }

            Console.WriteLine ("Data generated at the database. Press a key to end test.");
            Console.ReadKey();

            // 
            // Application exit
            //
            Environment.Exit(0);
        }
    }
}

The dbContext and SYSTEMDATALOG classes were generated though EF model-first from an Oracle database. I´m using Visual Studio 2012 and ODAC 12.1.0.1.0 with Oracle Developer Tools 32-bit installed on development machine. All fresh install and working pretty fine when developing.

All runs fine in DEVELOPMENT, but neve in production.

I´m using in production WINDOWS SERVER 2012. I have tried the following approaches:

a) Install WS2012 from schatch and install ODAC 32-bit version 12.1.0.1.0 fresh from Oracle site. I did run install with ODAC 4 version.

I got "The provider is not compatible with the version of Oracle client". After some tries and some hours lost, with different approaches, I decided to go to a new method - non-installating Oracle

b) I fresh installed WS2012 and did no ORacle installation. Copied the DLLs stated in the above links and now I´m getting "Unable to find the requested .NET data provider". I´ve copied all the available Oracle DLLs from DEV machine to the WS2012 EXE directory of my application and still getting that error.

My connection string (auto-generated by VS2012) is:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
  <connectionStrings>
    <add name="Entities" connectionString="metadata=res://*/DatabaseModel.DatabaseModel.csdl|res://*/DatabaseModel.DatabaseModel.ssdl|res://*/DatabaseModel.DatabaseModel.msl;provider=Oracle.DataAccess.Client;provider connection string=&quot;data source=//ORACLESERVER1:1521/MEZAMES;password=xxx;persist security info=True;user id=MZMESDB&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
</configuration>

This string is being generated into 2 files: TestDbConnection.exe.config and TestDbConnection.vshost.exe.config (I´m copying the bin/Debug folder to the server).

So, I need help to deploy my app to the new server. Some questions:

a) Which DLL is needed to go with the application for ODAC 12.1.0.1 ? Does that changed from ODAC 11 ?

b) Is that last error regarding EF or Oracle ?

c) Why does VS generated 2 config files ?

d) Does "providerName="System.Data.EntityClient" is the cause of the error ? If so, what DLL should be copied together.

e) Is there any tool/way to know what´s missing or with incompatible version, avoiding copying and trying methods ?

f) Is something missing on the config file ?

Thanks all for any kind of help. This is making me crazy as I´m stuck on that since the beggining of the week...

Community
  • 1
  • 1
Mendes
  • 17,489
  • 35
  • 150
  • 263

1 Answers1

1

I'm not sure about the installation options for ODAC in a server environment. I know you need the Transaction module only if you're using TransactionScope in your code.

The problem you're seeing from not being able to find the provider is because Oracle changed the provider name from Oracle.DataAccess.Client to Oracle.ManagedDataAccess.Client with the 12c bits.

You need to change this in both the connection strings and in the SSDL section of the EDMX file: you will go from

<edmx:StorageModels>
  <Schema Namespace="Model.Store" Alias="Self" Provider="Oracle.DataAccess.Client" (...)

to

<edmx:StorageModels>
  <Schema Namespace="Model.Store" Alias="Self" Provider="Oracle.ManagedDataAccess.Client" (...)
David Rodrigues
  • 622
  • 5
  • 8