IyaTaisho
IyaTaisho

Reputation: 863

Issue with Entity Framework and Oracle

I have an environment that uses Oracle.DataAccess.dll for Oracle 12c (ODAC is 32 bit and version is 4.122.1.0) for it's connection to the Oracle DB. In this environment, the Oracle DB is on the same machine as the ODAC (for development purposes).

Previously, I had the two working together so that my .NET application could run and access the DB. I recently had to switch out computers and reinstalled everything to my new environment. However, like always, the ODAC is being a bit stubborn.

I can connect to the DB using the following:

var conn = new OracleConnection(connectionString);
try
{
   conn.Open();
   conn.Close();
   return "Yes";
}
catch (Exception ex)
{
   return "No, because: " + ex.Message;
}

However, the application I work on opens the connection through Entity Framework instead. It uses the following:

public DatabaseContext()
       : base(new OracleConnection("Data Source=localhost:1521/dbName;User Id=dbUser;Password=dbPassword;"), true)
{
}

The way the application previously ran did work on my other laptop, but this new machine I'm on throws the following error when I try to run the application:

Unable to determine the provider name for connection of type Oracle.DataAccess.Client.OracleConnection'.

My tnsNames.ora for the client is configured as follows:

dbName =
   (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = dbName) 
    )
  )

I've gone through multiple installs of the ODAC and Oracle itself. At this point, I'm kind of out of ideas. Any help would be welcomed.

Upvotes: 0

Views: 163

Answers (1)

IyaTaisho
IyaTaisho

Reputation: 863

I figured out the issue. It is part of the installation that is the problem. When I installed, I skipped the Configure Provider for .NET setting. My previous documentation said to not select it, but obviously it's wrong. Selecting that setting fixed the issue immediately.

Upvotes: 0

Related Questions