connecting C# with Oracle database - c#

I have C# and Oracle 10g installed on my workstation.And also created a C# program,so my problem is i cant connent my C# application with Oracle database.it is really freaking me out.when adding Reference i cant find "Oracle.DataAccess.dll".thnx in advance.#Amu

Have you installed ODAC (oracle client) components on you workstation?
If you would use Oracle.Data namespace You need them. You can download from here
Please chek database version and bitness, because it is an important factor.
If you dont want to install Oracle client, you could try to use System.Data.OracleClient namespace, that's bundled with framework. In this case take in account that's deprecated and will be removed on next version of framework (link)

Related

Trying to use Entity Framework with Oracle DB

Hi I am trying to use Entity-Framework in asp.net MVC , for that I have installed Oracle.Managed.DataAccess version 19.6.0 and Oracle.Managed.DataAccess.EntityFramework version 19.6.0
and oracle version 11.2.0 I am able to connect Oracle DB in server explorer but while adding new item in solution not getting any option to connect Oracle DB what is the issue I am not able to identify ,Any idea would be appreciated.
Image
Those are just the Nuget packages to allow your project to connect to Oracle.
I believe you need to add Oracle Developer Tools for Visual Studio to have the options available in the Visual Studio dialogs.
https://www.oracle.com/database/technologies/developer-tools/visual-studio/
You need to install a Oracle Client and TNSNAMES.ORA
The installation has a component list, if you insall that components (like Oracle developer Tools for visualStudio) it you can add your EF. and then when you finish you only need to add your TNSNAMES in order to create the Entities in VS.

asp.net application not connecting to oracle 11g even after installing oracle instant client for 11g

I have a asp.net mvc application which is using oracle 11g database. In development machine every thing worked fine, but while deploying it in production server asp.net application is not able to connect to the database server. It is always throwing an empty exception.
I wrote also a simple console application to test the db connectivity. It is also not working. Then I realized it is because that the machine doesn't have a oracle client installed. so I installed Oracle instant client for 11g database 32 bit version. After this the console application started working but the web application still could not connect.
I google lot and finally decided to analyse using process monitor. In process monitor I found that the web application (iis) is looking for an oraclient12.dll.
This oraclient12.dll is part of oracle client for 12c database. I can't understand why it is looking for this dll.
After installing oracle database client for 12g, the above issue with oraclient12.dll got fixed. but iis is now not able to locate oraclsce12.dll.
I searched the whole file-system for this file but could not find.
does anyone know what should i install to get oraclsce12.dll.
Thanks,
Sujith
I was facing similar issue, then came to know that for the dll to be installed you should now also install the option «Oracle Advanced Security»,, by choosing custom installation when installing the oracle 12 client. I did the same and my issue got resolved. You can try this and see if your issue gets resolved.
thanks Sudharsan
This is documented as Oracle bug 17379890.
Oracle provides two workarounds:
Workarounds include:
To avoid the issue in the first place, explicitly select "Oracle NET" component during install
After the fact, you can
do another custom install into the same home, and select "Oracle NET"
copying ORACLSCE12.DLL from an existing install into OH\bin also resolves the issue.
However, making a single copy of file ORACLSCE12.DLL is not sufficient because there are more files which are missing. The workaround works only for certain applications. For example for tnsping.exe you still get an error due to missing files.
You have to take the first solution, i.e. explicitly select "Oracle NET" component during install

Is ODAC must for C# Oracle Database connectivity using ODP.net

I am new to Databases and .net!
I have SQL developer 3.0 installed through which I can connect to the Oracle 11g Database server.
The requirement is to write a C# program to connect to the oracle database and run query; in my visual studio 2013 project I have added a reference to Oracle.DataAccess.Client and written the code, however while debugging an error occurs that says "Ora-12541:TNS:No-Listener".
My question for now is, Do I need to install an Oracle client (64-bit ODAC 11.2 Release 6 (11.2.0.4.0) Xcopy for Windows x64 ?), my assumption was SQL developer will take care of this!
Please help!
SQL Developer has it's own Oracle drivers (JDBC as far as I know), thus you must install Oracle Client in order to connect to an Oracle DB in Visual Studio.
Note, "ODAC" contains only the ODP.NET Data Provider (i.e. mainly the Oracle.DataAccess.dll file). In order to use it, you must install the actual Oracle Client - at least the Instant Client (which is also included in the ODAC Download file).
Consider to use the ODP.NET Managed Driver, then you need only one single DLL, nothing else. It can be downloaded from Oracle page 64-bit Oracle Data Access Components (ODAC) Downloads and works for both 32bit and 64bit applications.
Unless you copied Oracle.DataAccess.dll from another machine, all oracle packages that include it, also include some version of the client. ODAC includes the full version while the xcopy installs have the instant client. I'll also point to the managed provider though for simplicity as it does not have any unmanaged dependencies,
However, if you got all the way to an "ora-xxxxx" error, it sounds like your Oracle client is correctly installed. The only issue you have now is your connection string. If you normally use a TNS name in Sql Developer, than you either need to copy your existing tnsnames.ora to network/admin in your new oracle home dir, or you need to set a TNS_ADMIN system environment variable to point to your existing one. There are other options too, but your error in this case is tns specific.

How can I configure an "INDEPENDENT" .NET application with DB Connection to Oracle?

I have a WebService developed in .NET which connects to an Oracle Database. To do that I use the ODAC which Oracle Provides.
But every time I need to install my application on the Client Machines, I have so much trouble regarding the "Oracle Client", depending on if he already has an Oracle Client installed that is not the same version, or if he has one with a different platform (32bit, 64 bit), or anything else.
The point is I spend too much time trying to fix that thing every time.
Is there a way I can configure my application that I can install it, and it has everything it needs. And I don't need to worry about what the server has installed or what will be installed on it. Is there a way?
ODP.NET is distributable and multiple versions can be installed on one machine. You can include it with your app and that will minimize versioning issues.
It sounds like you are currently using the unmanaged ODP.NET driver. If so, have a look at the XCopy install. You can look at how the scripts work and include them in your own install.
If you can use the Fully Managed ODP.NET that will mostly eliminate the 32-bit vs 64-bit issue (unless you are using distributed transactions). And it is only 10 MB.
http://www.oracle.com/technetwork/topics/dotnet/whatsnew/index-101716.html
Maybe you can check out the Oracle Instant Client?
Oracle Instant Client
The Basic download contains all files needed if you're only wanting to connect to the db from your .Net app. I have used this a lot in the past. Simple install, too.

Microsoft Access Database instead of SQLite or Local Database

Does a Microsoft Access Database is a possible solution to this question? SQLite seems to be exactly what I want but I cannot make it work in the .NET framework 4.0.
I was thinking about using a Microsoft Access Database but I don't know if when deploying my application the database is going to be portable?
Do users need to have Microsoft Access installed in their computers if I plan to deploy my application with a Microsoft Access Database?
In case all this is possible and I decide to use a Microsoft Access DB where will I place the database?
As a resource and extract it when installing it?
I haven't had problems using SQLite using with the provided .NET assemblies.. As an alternative you could try using Microsoft's SQL Server CE, which is a lightweight database designed for deploying to clients. I don't see why you'd use Access db instead of either of the other two..
Filip-fku thanks to your answer I found how to work with SQLite and the .Net framework 4.0 in here
The Jet database engine is installed on every copy of Windows beginning with Windows 2000, so if you use MDB format, you don't have to install anything to have access to a Jet MDB file.
If, however, you use ACCDB format, you'd have to install the ACE.

Categories