OLEDB 与 ODBC
OLEDB 和 ODBC 有什么区别? 我什么时候使用哪个以及如何知道我正在查看的是 OLEDB 驱动程序还是 ODBC 驱动程序?
What is the difference between OLEDB and ODBC? When do I use which and how do I know what I am looking at is a OLEDB driver v/s an ODBC driver?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
OLEDB 和 ODBC 是两种不同的数据库 API。 ODBC 是一个较旧的标准,实际上并不特定于 Windows - 您可以获得基于 Unix 的 ODBC 库。 OLEDB 是用于数据库连接的基于 COM 的 API。
如果您使用的数据库没有附带本机 OLEDB 驱动程序,则可以使用 OLEDB 前端包装 ODBC 的驱动程序。 IIRC DB2/400 和 Sybase OLEDB 驱动程序(例如)使用此方法。
Windows 中的 ODBC 管理员只关心 ODBC 驱动程序。 ODBC 和 OLEDB 都可以使用连接字符串,其格式略有不同。 您可以从连接字符串中看出 - www.connectionstrings.com 提供了许多不同数据库驱动程序的连接字符串示例。
编辑:Oracle 拥有适合一周中每一天的驱动程序技术。
Oracle 有一个本机 OLEDB
驱动程序 称为“Oracle 提供程序”
对于 OLEDB' 或类似的东西。 如果你是
使用 ADO(非 .Net,位于
OLEDB)这将是首选
驱动程序。
他们还有一个 ODBC 驱动程序
这(例如)对于
从 Oracle 数据库中提取
进入 MS-Access 或使用不支持 OLEDB 的应用程序或系统。 例如,较旧的 Delphi/Oracle 或 Powerbuilder/Oracle 应用程序可能会使用此驱动程序。
Oracle 还有一个
Oracle 特定的接口称为
OCI。 这是最快的
接口,如果你用 C 编写并且
也适用于非 Windows
平台但绑定您的应用程序
到甲骨文。 动态语言绑定(例如 Python 的 cx_Oracle)往往是 OCI 的包装器。
如果您使用 .Net,您可能
想要 ODP.Net 而不是
使用 .Net 提供 OLEDB。 这是
标准.Net接口库
由 Oracle 提供。
有多个 JDBC 驱动程序
甲骨文。 有一个 type-2 驱动程序
这是 OCI 的包装器和
编写的 type-4 驱动程序
本地使用 Java 进行通信
直接通过网络到
服务器。 如果您使用 Java,则类型 4 驱动程序可能最适合大多数应用程序(您不必安装完整的 Oracle 客户端),除非您有特殊原因需要类型 2 驱动程序。
OLEDB and ODBC are two different database API's. ODBC is an older standard and is actually not specific to windows - you can get Unix-based ODBC libraries. OLEDB is a COM-based API for database connections.
There is a driver for wrapping ODBC with an OLEDB front-end if the database you are using does not come with a native OLEDB driver. IIRC DB2/400 and Sybase OLEDB drivers (for example) use this method.
The ODBC administrator in Windows is only concerned with ODBC drivers. Both ODBC and OLEDB can use connection strings, which have a slightly different format. You can tell from the connection string - www.connectionstrings.com has samples of connection strings for many different database drivers.
Edit: Oracle has a driver technology for every day of the week.
Oracle have a native OLEDB
driver called 'Oracle provider
for OLEDB' or some such. If you're
using ADO (non-.Net, which sits over
OLEDB) this would be the preferred
driver.
They also have an ODBC driver
that would be (for example) useful for
extracting from an Oracle database
into MS-Access or with an application or system that does not support OLEDB. For example, older Delphi/Oracle or Powerbuilder/Oracle apps will probably use this driver.
Oracle also has an
Oracle-specific interface called
OCI. This is the fastest
interface if you're writing in C and
will also work on non-windows
plaforms but ties your application
to Oracle. Dynamic language bindings such as cx_Oracle for Python tend to be wrappers around OCI.
If you're using .Net you probably
want ODP.Net rather than
using the .Net provide for OLEDB. This is the
standard .Net interface library
provided by Oracle.
There are several JDBC drivers for
Oracle. There is a type-2 driver
which is a wrapper for OCI and a
type-4 driver which is written
natively in Java and communicates
directly over the network to the
server. If you're using Java the type-4 driver is probably the best for most applications (you don't have to install a full Oracle client) unless you have a particular reason to need the type-2 driver.