[英]Connecting C# to Oracle
What is the best library/driver to connect C# (.NET) application to Oracle 10g and 11g. 将C#(.NET)应用程序连接到Oracle 10g和11g的最佳库/驱动程序是什么。
Current options that I found are: 我找到的当前选项是:
Can somebody explain differences? 有人可以解释一下差异吗?
I am planning C# application that will do basic CRUD operations on Oracle database. 我正在计划将在Oracle数据库上执行基本CRUD操作的C#应用程序。 Which library/driver is smallest and easiest to install?
哪个库/驱动程序最小且最容易安装?
Edit: 编辑:
General recommendation is to use ODP.Net. 一般建议是使用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:
我为Oracle 11g找到了3个不同的客户端:
So, which of those is enough for development? 那么,哪一个足够发展呢? Oracle documentation is painfully detailed, but says nothing about differences between those client packages.
Oracle文档非常详细,但没有说明这些客户端软件包之间的差异。 I would go with smallest (Instant Client).
我会选择最小的(即时客户端)。 Is it best choice?
这是最好的选择吗?
Edit 2: 编辑2:
I am using .Net 3.5 我正在使用.Net 3.5
To connect C# to oracle you need a data provider for .net. 要将C#连接到oracle,您需要.net的数据提供程序。 This can be one of the following:
这可以是以下之一:
All of this data provider need an oracle client installed. 所有这些数据提供者都需要安装oracle客户端。 There is no standalone library as jdbc14.jar as in java.
没有独立的库作为jdbc14.jar,就像在java中一样。 You have 2 choices deploying an oracle client:
您有2个选择部署oracle客户端:
ODP.Net, ODBC, OLEDB are part of full client. ODP.Net,ODBC,OLEDB是完整客户端的一部分。 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.
这是部署oracle客户端的最小方法。
I would suggest using ODP.Net with Oracle Instant Client , because this easy to deploy and very very light weight. 我建议将ODP.Net与Oracle Instant Client一起使用 ,因为这样易于部署且重量非常轻。
Which instant client packages do you need: 您需要哪些即时客户端软件包:
There are a lot of articles on stackoverflow about deployment of oracle instant client with c# applications. 关于使用c#应用程序部署oracle即时客户端的stackoverflow有很多文章。
EDIT: updated links and versions 编辑:更新的链接和版本
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: ODP.NET是访问Oracle数据库的最佳提供程序,主要是因为它是最本机的,它通过以下方式区别于ODBC:
ODBC can also be used but as mentioned above it's going to be slower and have limited functionality. 也可以使用ODBC,但如上所述,它会更慢并且功能有限。
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 要使ODP.NET工作,您需要此处列出的软件(包括oracle客户端): http : //www.oracle.com/technology/tech/windows/odpnet/faq.html#install
Hope this helps! 希望这可以帮助!
Maybe I'm wrong but ADO.NET have integrated support for Oracle. 也许我错了,但ADO.NET已经集成了对Oracle的支持。 maybe for earlier versions...
也许对于早期版本......
I think odbc is too slow. 我觉得odbc太慢了。 System.Data.OracleClient is a bit slow too and it will be deprecated by Microsoft.
System.Data.OracleClient也有点慢,它将被Microsoft弃用。
You could use devart's provider, there is a free version. 你可以使用devart的提供者,有一个免费版本。 It is easy to deploy.
它易于部署。 See here http://www.devart.com/dotconnect/oracle/ It does support the entity framework.
请参见http://www.devart.com/dotconnect/oracle/它确实支持实体框架。
Odp.net is fast but it doesn't support the entity framework and it isn't very easy to deploy. Odp.net速度很快,但它不支持实体框架,因此部署起来并不容易。
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. 我真的不能说你提供的解决方案之间的差异,但我总是使用Oracle提供的Oracle数据访问组件,它始终完美无瑕。 It could be found here : ODAC for Visual Studio
它可以在这里找到: 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. 可以肯定的是,Oracle在.NET Framework上开发的库比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.
例如,关于访问Oracle数据库时抛出的异常,如果Oracle开发团队已经开发了这些库,那么它们会更有帮助,因为他们对Oracle数据库有额外的了解。
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. 糟糕的是,如果您选择使用.NET System.Data.OracleClient,您将有一个依赖性问题,您不必克服这个问题。
Hope this helps. 希望这可以帮助。 Regards.
问候。
EDIT : The ODAC package contains ODP and Oracle Developer Tools 编辑:ODAC包包含ODP和Oracle Developer Tools
ODP.NET is a native provider fo accessing oracle db. ODP.NET是访问oracle db的本机提供程序。 And hence it should be better optimized for oracle db.
因此它应该更好地优化oracle db。 Moreover, there are oracle feature, such as REF CURSOR type, which are not supported by MS ODBC, but supported by ODP.NET.
此外,还有oracle特性,例如REF CURSOR类型,它们不受MS ODBC支持,但受ODP.NET支持。 You can download ODAC, which include ODP.NET as well, on the www.aracle.com website.
您也可以在www.aracle.com网站上下载ODAC,其中包括ODP.NET。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.