SQL Server:本机客户端与 ODBC?

发布于 2024-10-24 17:59:29 字数 58 浏览 7 评论 0原文

SQL Server Native Client 连接和 ODBC 连接有什么区别?这两者有何优缺点?

What is the difference between SQL Server Native Client connection and ODBC connection? What are the pros and cons of these two?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

旧伤慢歌 2024-10-31 17:59:29

啊? ODBC 正式消亡了吗?有人可能想让 Microsoft 知道:

Microsoft 正在与 ODBC 保持一致以进行本机关系数据访问

从上面的链接:

ODBC 是本机关系数据访问事实上的行业标准...

并且

Microsoft SQL Server 的商业版本(代号“Denali”)将是支持 OLE DB 的最后一个版本

最后,

“我们鼓励您在开发应用程序的新版本和未来版本时采用 ODBC。您无需使用 OLE DB 更改现有应用程序,因为它们将继续虽然这为您在弃用生效之前提供了很大的机会来更改应用程序,但您可能需要考虑将这些应用程序迁移到 ODBC,作为 Microsoft 完全致力于的未来路线图的一部分。使这一过渡尽可能顺利和容易。""

(强调)

Huh? ODBC is officially dead? Someone might want to let Microsoft know that:

Microsoft is Aligning with ODBC for Native Relational Data Access

From the above link:

ODBC is the de-facto industry standard for native relational data access...

and

The commercial release of Microsoft SQL Server, codename 'Denali' will be the last release to support OLE DB.

and finally,

"We encourage you to adopt ODBC in the development of your new and future versions of your application. You don’t need to change your existing applications using OLE DB, as they will continue to be supported on Denali throughout its lifecycle. While this gives you a large window of opportunity for changing your applications before the deprecation goes into effect, you may want to consider migrating those applications to ODBC as a part of your future roadmap. Microsoft is fully committed to making this transition as smooth and easy as possible.""

(emphasis added)

垂暮老矣 2024-10-31 17:59:29

当底层数据库可能发生变化但您不希望代码发生变化(假设 SQL 在各种技术中保持不变)时,ODBC 非常有用。您可以有一天连接到 Oracle 数据库,第二天切换到 SQL Server 数据库。缺点是您无法获得特定驱动程序所提供的优化。 SQL Server Native 客户端驱动程序已被证明比仅使用标准 ODBC 驱动程序要快得多。

ODBC is useful for times when the underlying database might change but you don't want your code to (assuming the SQL stays the same across technologies). You could connect to an Oracle database one day and switch out to a SQL server database the next. The disadvantage is that you don't get the optimizations that having specific drivers affords you. The SQL Server Native client driver has been proven to be much faster than just using a standard ODBC driver.

千仐 2024-10-31 17:59:29

SQL Server Native Client 连接和 ODBC 连接有什么区别?

ODBC 是一个标准化的 API。

ODBC 驱动程序是使用本机协议(例如 SQL Server 共享内存或 SQL Server TCP/IP)来实现 ODBC 接口的共享库。

换句话说,ODBC 是一种抽象,它使代码能够针对多种数据库技术工作。

它类似于Java的JDBC,或Python的DB-API,或GO的database/sql,只不过ODBC驱动程序使用C函数。此外,它们更频繁地安装在系统级别。


ODBC 具有任何抽象的常见优点和缺点。

  • 优点:使代码更加灵活/可移植。

  • 缺点:增加性能开销并且功能较少。

听起来您知道您将使用 SQL Server 并且将始终使用 SQL Server。

在这种情况下,我会使用本机客户端库(如果可用)。

What is the difference between SQL Server Native Client connection and ODBC connection?

ODBC is a standardized API.

ODBC drivers are shared libraries that use native protocols (like SQL Server shared memory, or SQL Server TCP/IP) to implement the ODBC interface.

In other words, ODBC is an abstraction that enables code to work against multiple database technologies.

It's similar to Java's JDBC, or Python's DB-API, or GO's database/sql, except ODBC drivers use C functions. Also, they are more frequently installed at a system level.


ODBC has the usual pros and cons of any abstraction.

  • Pros: Makes code more flexible/portable.

  • Cons: Adds performance overhead and has fewer features.

It sounds like you know that you will use SQL Server and will always use SQL Server.

In that case, I'd use a native client library if it's available.

金兰素衣 2024-10-31 17:59:29

SQL Server Native Client 是一个动态链接库 (DLL),其中包含适用于 Windows 的 SQL OLE DB 提供程序和 SQL ODBC 驱动程序。

SNAC 11 是一个动态链接库 (DLL),包含 SQL
适用于 Windows 的 OLE DB 提供程序和 SQL ODBC 驱动程序。它包含运行时
支持使用本机代码 API(ODBC、OLE DB 和 ADO)的应用程序
连接到 Microsoft SQL Server 2005、2008、2008 R2 和 SQL Server
2012 年。单独的 SQL ODBC 驱动程序可用于 Linux。

https://blogs.msdn.microsoft.com/sqlreleaseservices/snac-lifecycle -解释/

SQL Server Native Client is a single dynamic-link library (DLL) containing both the SQL OLE DB provider and SQL ODBC driver for Windows.

SNAC 11 is a single dynamic-link library (DLL) containing both the SQL
OLE DB provider and SQL ODBC driver for Windows. It contains run-time
support for applications using native-code APIs (ODBC, OLE DB and ADO)
to connect to Microsoft SQL Server 2005, 2008, 2008 R2, and SQL Server
2012. A separate SQL ODBC-only driver is available for Linux.

https://blogs.msdn.microsoft.com/sqlreleaseservices/snac-lifecycle-explained/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文