First off I have read other posts about connecting to an Oracle database, unfortunately they could not help me. I'll describe what I have tried and hopefully someone can point me in the correct direction.
First off I tried to install ODTwithODAC122010 as many sources are saying,but this one gives me a few process exited with non zero exit code. It says it's successful but nothing seems to be changed.
Next to that I tried installing ODTforVS2017_122010.exe I have an updated Visual Studio professional. It says the installation is a success. This however does not seems to add any option like tutorials describe. With this I mean that there should be something visible in;
visual studio tools -> connect to database -> Oracle database, data provider menu should have something like Oracle for.. This doesn't show up unfortunately..
So I tried connecting to the database in my visual studio project selecting the .net framework data provider for oracle. Here three fields are asked: Server name username and password. I tried filling them in but it couldn't connect. For server name I used: IPADDRESS:PORT/SERVICENAME
After that I gave up hope for connecting to the database through visual studio (I can connect to the database using oracle SQL developer).
Then I installing the following nuget packages: - Oracle.ManagedDataAccess - System.Configuration.ConfigurationManager - System.Security.Permissions - System.Security.Principal
And wrote a piece of code to connect to the database like:
using(OracleConnection connect = new OracleConnection(ConnectionDetails.returnConnectionString()))
{
connect.Open();
Console.WriteLine("did it work?" + connect.ServerVersion);
}
Where returnConnectionString returns:
"User Id=MYID;Password=MYPASSWORD;Data Source=IPADDRESS:PORT/SERVICENAME"
Unfortunately when I try to run this I'm facing a ExecutionContext.cs not found. This is happening at connect.open();
I'm launching this code at:
public static void Main(string[] args)
{
var a = new DatabaseConnector();
a.test();
BuildWebHost(args).Run();
}
As I final word I want to make it clear that I'm using ASP.NET Core and that your suggestions and help will be greatly appreciated!
To be precise,
In the page, import as below to access oracle classes
using Oracle.ManagedDataAccess.Client;
This is a beta version of Oracle data access provider and PROD version is supposed to be available at the end of 3rd quarter of 2018.
There's currently no ODP.NET support for .NET Core, it was suppose to be released last year, but there's been no news more than and it's coming tweet from the ODP twitter account a couple of weeks ago.
You can make the current version work by moving your project from .netcoreapp2 to a net461 or higher target framework, but it would remove the cross platform support from your project.
In order to move your project to .net461 or any other follow this steps:
TargetFramework
with net461Microsoft.AspNetCore.All
package and install the Microsoft.AspNetCore
(which should download the others dependencies).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