-1

Quick question. I have a school assignment for which I am given connection information for an Oracle Server including the server URL, port number, login ID, password, SID, and the server address. We have complete freedom to use whatever language we want and I chose C#. I was wondering if someone could recommend what library to use to connect to the database server and query it. I tried to search on Google for this information but all of the existing articles seem to be either using an deprecated library that is no longer available in Visual Studio 2012/.NET 4.5 or require an Oracle library that requires a mind-numbingly complex procedure to install at first glance. I was hoping someone could recommend a simple-to-install library with a small footprint that I could use to query this oracle database server using the given connection information. Bonus points if you can link an article with example code.


So I downloaded and installed ODP.net (added the installation directory and the bin directory to the PATH environment variable and everything) and for some reason Visual Studio does not show it as a reference in the list of references. I tried to circumvent this by simply adding the path of the dll as a reference (in my case: C:\Tools\Oracle...\Oracle.DataAccess.dll) and at first everything was fine. Even intellisense was seeing the library's classes and stuff, but then when I actually tried to run the code it said:

Could not load file or assembly 'Oracle.DataAccess, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. An attempt was made to load a program with an incorrect format.

Do you know what either one of those problems could be caused by?

BenMorel
  • 34,448
  • 50
  • 182
  • 322
RedHack
  • 285
  • 7
  • 18
  • Hi RedHack - have you taken a look at this [post about Oracle/C# 4.5](http://stackoverflow.com/questions/11544822/cannot-see-oracle-data-provider-for-net-in-visual-studio-2012-rc) Are you able to comprehend to arrive in a direction to your school project? – bonCodigo Nov 13 '12 at 06:24
  • Yes, I've seen that post, and I do not need entity framework access, I need very basic access to an oracle database with a connection object and the ability to query the database with SQL statements. That post on the other hand seems to be focused entirely on the Entity Framework and the semantics of .NET 4.5. – RedHack Nov 13 '12 at 14:01

2 Answers2

2

You should use the recommended Oracle Data Provider for .NET by Oracle. OracleConnection Class provided by Microsoft is obsolete since .Net framework 4.0

Oracle Data Provider for .NET (ODP.NET) features optimized ADO.NET data access to the Oracle database. ODP.NET allows developers to take advantage of advanced Oracle database functionality, including Real Application Clusters, XML DB, and advanced security. The data provider can be used with the latest .NET Framework 4 version.

ODP.NET makes using Oracle from .NET more flexible, faster, and more stable. ODP.NET includes many features not available from other .NET drivers, including a native XML data type, self-tuning, RAC-optimized connection pooling, promotable transactions, and Advanced Queuing.

Habib
  • 219,104
  • 29
  • 407
  • 436
1

I suggest to use NHibernate. (it's using ODP.NET as Data Provider)

Here is usage example : http://nhbwithoracle.blogspot.ru/

cnd
  • 32,616
  • 62
  • 183
  • 313