5

I am getting this error where Visual Studio 2019 is unable to find

 Imports Oracle.DataAccess.Client

I have downloaded https://www.oracle.com/database/technologies/odac-downloads.html and https://www.oracle.com/database/technologies/dotnet-utilsoft-downloads.html

am I missing something? It still says it can't find it as a result all my code using Oracle says it is inaccessible.

software is fun
  • 7,286
  • 18
  • 71
  • 129
  • 1
    Are you sure you don't want the `Oracle.ManagedDataAccess` Nuget package, and `Imports Oracle.ManagedDataAccess.Client`? – Andrew Morton Feb 04 '20 at 16:52
  • I am not sure what I need. Is this the newer approach? – software is fun Feb 04 '20 at 16:54
  • Nuget packages are the new way of getting libraries, if that is what you are referring to, otherwise [Migrating from ODP.NET, Unmanaged Driver to ODP.NET, Managed Driver](https://docs.oracle.com/database/121/ODPNT/InstallMigrateUDtoMD.htm#ODPNT8267), except you won't need step 1. N.B. I have no experience of this. – Andrew Morton Feb 04 '20 at 18:30
  • Does your project have a reference to Oracle.DataAccess.dll? If you don't use the NuGet method to get the driver, you typically have to add a reference to the dll on the project in Visual Studio. – dandarc Feb 04 '20 at 19:20
  • my project is using Microsoft.System.Data and I've been tasked to modernize the code to use Oracle (Since Microsoft's Oracle driver is deprecated). I can use ODP.net or anything that is supported – software is fun Feb 04 '20 at 19:35
  • @softwareisfun Ah, in that case, the Oracle managed drivers came out in something like the year 2013, so they would be the more modern version. – Andrew Morton Feb 05 '20 at 11:11
  • You should use Managed Driver unless you have a compelling need for unmanaged (unimplemented feature for example). Managed is so much easier.. it is one or two dlls with little configuration required on the target machine. – Christian Shay Feb 13 '20 at 22:45

2 Answers2

5

As the aim is to modernize the software, using the most up-to-date Oracle library would be best, which would currently be Oracle.ManagedDataAccess.

It is available as a Nuget package (in Visual Studio, "Tools" menu -> "NuGet Package Manager" -> "Manage NuGet Packages for Solution..." -> choose the "Browse" tab -> search for "Oracle.ManagedDataAccesss"; tick the box in the pane over to the right a bit to add it to your Project ->click "Install"), which means there is no need to worry about finding and adding references to .dll files.

Then, add Imports Oracle.ManagedDataAccess.Client.

If the code was previously using an Oracle database then it may be necessary to make some changes as mentioned in step 3 of Migrating from ODP.NET, Unmanaged Driver to ODP.NET, Managed Driver.

Andrew Morton
  • 24,203
  • 9
  • 60
  • 84
3

Did you add Oracle.DataAccess reference to project? Right click on project name in solution explorer -> add reference -> .NET -> Oracle.DataAccess

dargin
  • 61
  • 4