tags:

views:

471

answers:

7

What is the best library/driver to connect C# (.NET) application to Oracle 10g and 11g.
Current options that I found are:

  1. Oracle client that comes with database installation
  2. Oracle Instant Client (which is a bit confusing since it has 6-8 versions for number of operating systems)
  3. Microsoft ODBC ? (Can this be used?)
  4. ODP.Net - is this separate product or is it included in 1. and 2. ?

Can somebody explain differences?

I am planning C# application that will do basic CRUD operations on Oracle database. Which library/driver is smallest and easiest to install?

Edit:
General recommendation is to use ODP.Net. Now, can somebody please explain or point to answer about differences between client install packages. I found 3 different clients for Oracle 11g:

So, which of those is enough for development? Oracle documentation is painfully detailed, but says nothing about differences between those client packages. I would go with smallest (Instant Client). Is it best choice?

Edit 2:
I am using .Net 3.5

+2  A: 

Maybe I'm wrong but ADO.NET have integrated support for Oracle. maybe for earlier versions...

Trickster
System.Data.OracleClient is a bit slow too and it will be depricated by Microsoft.
tuinstoel
Yes now i see. Thanks to this thread!
Trickster
+7  A: 

Microsoft will deprecate the System.Client.OracleClient namespace so I think it will be best to use ODP.NET. Make sure you download the latest one (ODP.NET 11g) as previous versions had some issues.

Darin Dimitrov
There are also *significant* differences in the functional capabilities available between ODP.NET and the (now deprecated) OracleClient library. ODP.NET provides much better access to both the basic and advanced features of the Oracle database.
LBushkin
Why is MS deprecating that ?
JonH
@JonH The ADO.NET team talked about it here: http://blogs.msdn.com/adonet/archive/2009/06/15/system-data-oracleclient-update.aspx
Jeremy Seghi
Thanks. Can you please comment on second part of question, after "Edit"
zendar
+2  A: 

I think odbc is too slow. System.Data.OracleClient is a bit slow too and it will be depricated by Microsoft.

You could use devart's provider, there is a free version. It is easy to deploy. See here http://www.devart.com/dotconnect/oracle/ It does support the entity framework.

Odp.net is fast but it doesn't support the entity framework and it isn't very easy to deploy.

tuinstoel
Thanks. Can you comment on differences between Oracle client installs I mentioned after "Edit" mark.
zendar
+1  A: 

I really cannot say the differences between the solutions you provided but I always used the Oracle Data Access Components from Oracle and it always worked flawlessly. It could be found here : ODAC for Visual Studio

What is sure is that a library developped by Oracle on the .NET Framework will be much more accurate than a library developped by an company external to Oracle. For example, concerning exceptions thrown when accessing an Oracle database, they will be much more helpful if the library have been developped by the Oracle developping team as they have additional knowledges on Oracle DBs.

The bad thing is that you will have a dependency, problem that you will not have to overcome if you chose to use the .NET System.Data.OracleClient.

Hope this helps. Regards.


EDIT : The ODAC package contains ODP and Oracle Developer Tools

Ucodia
Thanks. Do you maybe know difference between ODAC and Instant client packages?
zendar
It seems like the Oracle Instant Client does not have anything to do with .NET, it just belongs to Oracle Database applications. See more there : http://www.oracle.com/technology/tech/oci/instantclient/index.html
Ucodia
+3  A: 

ODP.NET is the best provider for accessing Oracle db, mostly - because it's the most native one, which differentiates it from ODBC by the following:

  • better performance
  • ODP.NET provides access to advanced Oracle functionality, not available via ODBC .NET
  • ODP.NET does not use an extra data access bridge.

ODBC can also be used but as mentioned above it's going to be slower and have limited functionality.

For making ODP.NET work you need the software listed here (and including oracle client): http://www.oracle.com/technology/tech/windows/odpnet/faq.html#install

Hope this helps!

Alexander
Thanks. Can you please comment on second part of question, after "Edit". I need help to pick "best" client package.
zendar
From those you mentioned you will need the ODAC package. It includes ODP.NET and the client. Both of them are required for connecting to the Db.
Alexander
+2  A: 

ODP.NET is a native provider fo accessing oracle db. And hence it should be better optimized for oracle db. Moreover, there are oracle feature, such as REF CURSOR type, which are not supported by MS ODBC, but supported by ODP.NET. You can download ODAC, which include ODP.NET as well, on the www.aracle.com website.

+2  A: 

To connect C# to oracle you need a data provider for .net. This can be one of the following:

  • ODP.Net (Oracle)
  • System.Data.OracleClient (Microsoft)
  • ODBC (Oracle)
  • OLEDB (Oracle)
  • DataDirect ADO.NET Data Provider for Oracle (DataDirect)
  • may be some other provider

All of this data provider need an oracle client installed. There is no standalone library as jdbc14.jar as in java. You have 2 choices deploying an oracle client:

  • full client (may be from database installation)
  • instant client

ODP.Net, ODBC, OLEDB are part of full client. This is the "hard" way because an installation process must be run on every client runing your software. This is where the most megabytes are put on the client.
The instant client is provided in different packages. This is the smallest way for deployment of an oracle client.

I would suggest using ODP.Net with Oracle Instance Client, because this easy to deploy and very very light weight.

Which instant client packages do you need:

  • Pick version 11.1.0.6.0
  • Instant Client Package - Basic (if you need full language support)
  • Instant Client Package - ODAC

There are a lot of artikels on stackoverflow about deployment of oracle instant client with c# applications.

Christian13467