Connect to Oracle database from asp.net core - c#

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,
Right click on your project
Go to Manage NuGet packages
Search for Oracle.manageddataaccess.core . You will get Nuget package 2.12.0-beta2 version. Add it.
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:
Edit your csproj file and replace the TargetFramework with net461
If you have a web project then remove the Microsoft.AspNetCore.All package and install the Microsoft.AspNetCore (which should download the others dependencies).

At the time of asking this question there was no driver Roy Sanchez answered that. A few weeks the driver got released on the oracle site and a as a nuget package.

Related

ASP.NET, Visual Studio 2019, MySQL. The data provider 'Mysql.Data.MySqlClient' could not be found

When I try to set SqlDataSource I've got provider error. Server connection checked and it works
Editor image:
Error message image:
Problem is similar to this thread but recommended fix doesn't work and IDK what to do
Error picture from thread above
I've installed MySQL connector, MySQL for Visual Studio, but it doesn't help to me
UPD: Here's a minimal project with an SQL DB (var_23.sql). In Web.config described a connecting to DB, the "Doctors" page has a SqlDataSource element, that do connection
From my experience, Please install "Data storage and processing" in visual studio installer.
If the corresponding package is missing during the compilation process, use Alt+enter to pop up a quick prompt to add it (you could also right-click Reference->Manage Nuget Packages to add the corresponding package)
Updated:
It turns out that I can run your program correctly, I downloaded a community version of mysql 8.0, and imported your database.
Because you create in Framework, I suggest you can remove providerName="MySql.Data.MySqlClient".
Please let me know if I misunderstood your question.

Making a C# SQLite Database first model appear out of thin air

I am trying to make a tiny application, using SQLite and EF6.
I already have an SQLite database with tables and data, so I want to create a model and populate it from that. However despite everything I've tried I have had no success.
When adding a new "ADO.NET Entity Data Model" I have no option for SQLite database (this is on Visual Studio 2015).
I already saw this, this and this.
What I have done so far:
- First tried to simply install SQLite by NuGet - no luck.
- Then I created a new project, and instead of NuGet installed the latest x32 System.Data.SQLite setup package and made sure to check the option of installing design-time components for Visual Studio 2015 - no dice
- Then I saw someone had luck with installing an older version of the setup packages. After a painstaking installation (after removing the newer version) - no cigar.
- So I started following this one and, hooray - I can't add the assemblies, despite telling the setup to put them in the Global Trash Can or whatever.
So I come to you, dear people, hoping someone can wave a magic wand and help me get this thing that's supposed to be tiny, fast and easy to be, you guessed it - at all working.

Unable to add Tables/Views/StoredProcedures through EDMX

I'm using Visual Studio 2015 & Syabse ASA DB (ver 16.0.0.2222) alongwith EntityFramework 6.1.3.
I add an ADO.NET Entity Data Model
-> I choose EF Designer from Database
-> Establish a New Connection
-> Select the option to Include information in Connection String
-> Click Next -> Ideally the next window should allow me to add Tables/Views/Procedures but Upon clicking Next the window closes.
You may check this link to understand my issue better (only difference is I'm on Visual Studio 2015 & the DB I'm using as Sybase ASA)- https://www.youtube.com/watch?v=4SwhYYAzx6I
Has anyone come across this kind of problem or know how to fix this?
Kindly advise.
I think you need the connector for avoid this.
You can try this:
Download the "Get a Free "Developer" Edition" here: http://scn.sap.com/community/developer-center/oltp-db
Choose Custom Install when installing.
Only install the .Net ADO package from the custom install.
Reference the Sybase.AdoNet4.AseClient.dll in your solution from where the install put the files on your drive.
After that you should be able to perform queries, updates etc. in your solution.
Read this if needed: http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.help.sdk_12.5.1.adonet/html/adonet/DAFJEFIF.htm
Hope this help.
I came across the solution & posting it so that it may help others.
What I already had done?
Install the latest developer edition from Sybase
Use command prompt with admin priviliges.
Naviagte to the path where SQL Anywhere (Sybase ASA) is installed containing the DLL's (in my case: C:/ProgramFiles/SQL Anywhere 16/Assemble/V4)
Execute SetupVsPackage.Exe -i -v 6
Update app.config file to match the latest provider.
Install EntityFramework 6.1.3 to the project where I would add EDMX file.
What I missed?
After step 4 above I had to run an additional command -
Execute SetupVsPackage.Exe -i -v EF6 (EF in caps)

Getting error when trying to create Entity Data Model from existing table in Visual Studio 2015

I've been trying to create a data model off of an existing database table using Entity Framework in Visual Studio 2015 for an MVC application. I'm able to test the connection to the MS SQL database I've been using successfully and choose the database itself, but whenever I click 'finish' I get error shown below.
I've tried following the instructions here, but it has not worked and I can't find any other answer.
Make certain you have added the assembly Microsoft.SqlServer.Management.Sdk.Sfc to your project. You can search for this assembly and install it via NuGet, or run the following command in the Package Manager Console:
Install-Package Microsoft.SqlServer.Management.Sdk.Sfc.dll
I found the answer. Chase's answer was close, but mine was a different version. I'm using SQL server 2012 and, according to the error message, I needed version 12. I found it here.

Strange Error while installing MySQL .Net connector 6.8.3

I'm already installing version 6.8.3 but it asks me to install a version greater that 6.7...
I just don't understand why this is happening...
I'm using Visual Studio 2012 and trying to install this latest connector for MySql to get Entity Framework to work.
any clue? Any Help is appreciated! Thanks.
I've recently had the same problem. When you install choose 'custom', then deselect the option to install web providers. Once I did that my install completed without error.
Well, even after going through a pile of bugs posted in MySQL forum for the same issue, I couldn't solve it. Finally I used a third party application uninstaller "REVO Uninstaller". You might want to try your preferred one in this case, I just googled for a good uninstaller and it said REVO that why I chose it. I did a full uninstall including registry entries and then tried to install the new version of MySQL Connector 6.8.3 and I succeed. This is how I made it. I hope it helps somebody.

Categories

Resources