“SQLNCLI”提供商未在本地计算机上注册

发布于 2024-08-05 09:46:42 字数 1769 浏览 3 评论 0原文

我有一个基于 NAnt 的脚本,我在本地 PC 上运行该脚本,该脚本连接到 SQL Server 2008 Express,该脚本也在我的本地 PC 上运行,以使用 .sql 文件删除和重新创建数据库 - 这工作正常,没有问题。

当我在另一台 PC 上重新创建相同的设置时,问题就出现了,我在 NAnt 脚本中收到错误消息:

System.InvalidOperationException: The 'SQLNCLI' provider is not registered on the local machine.
  at System.Data.OleDb.OleDbServicesWrapper.GetDataSource(OleDbConnectionString constr, DataSourceWrapper& datasrcWrapper)
  at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
  at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
  at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
  at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
  at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
  at System.Data.OleDb.OleDbConnection.Open()
  at NAnt.Contrib.Util.SqlHelper..ctor(String connectionString, Boolean useTransaction)
  at NAnt.Contrib.Tasks.SqlTask.ExecuteTask()
  at NAnt.Core.Task.Execute()
  at NAnt.Core.Target.Execute()
  at NAnt.Core.Project.Execute(String targetName, Boolean forceDependencies)
  at NAnt.Core.Project.Execute()
  at NAnt.Core.Project.Run()

我在线搜索并发现在论坛中建议我需要安装 Microsoft SQL Server本机客户端,从这个网址。 (诚​​然,我只安装了本机客户端部分)

尽管这是在我的第二台电脑上安装的,但脚本仍然给我同样的错误。有什么建议吗?

I have a NAnt-based script which that I run on my local PC that connects to SQL Server 2008 Express also running on my local PC to drop and recreate databases using .sql files - this works fine, no problem here.

The problem comes when I have recreated the same set-up on another PC, I get the error in my NAnt script saying that:

System.InvalidOperationException: The 'SQLNCLI' provider is not registered on the local machine.
  at System.Data.OleDb.OleDbServicesWrapper.GetDataSource(OleDbConnectionString constr, DataSourceWrapper& datasrcWrapper)
  at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
  at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
  at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
  at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
  at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
  at System.Data.OleDb.OleDbConnection.Open()
  at NAnt.Contrib.Util.SqlHelper..ctor(String connectionString, Boolean useTransaction)
  at NAnt.Contrib.Tasks.SqlTask.ExecuteTask()
  at NAnt.Core.Task.Execute()
  at NAnt.Core.Target.Execute()
  at NAnt.Core.Project.Execute(String targetName, Boolean forceDependencies)
  at NAnt.Core.Project.Execute()
  at NAnt.Core.Project.Run()

I have searched online and have found that in a forum it was suggested that I needed to install the Microsoft SQL Server Native Client, and got it from this URL. (Admittedly, I have only installed the Native Client part of this)

Despite this being installed on my second PC, the script still gives me the same error. Any suggestions?

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

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

发布评论

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

评论(2

独自←快乐 2024-08-12 09:46:42

SQL Server 2008 的正确提供程序是 SQLNCLI10.1
对于 SQL Server 2012,这将是 SQLNCLI11(source)

可悲的是,迁移到 2008 年并没有看到变化......

The correct provider for SQL Server 2008 is SQLNCLI10.1.
For SQL Server 2012, that would be SQLNCLI11. (source)

Sadly, the migration to 2008 did not pick up the change...

鯉魚旗 2024-08-12 09:46:42

难道是 x86/x64 的问题吗?如果相关工作站是 x64,并且您已经安装了 x64 版本的客户端,但您尝试运行的应用程序位于 x86 空间中,则您可能还需要在该工作站上安装 x86 版本的客户端。 x86 应用程序只会检查提供程序的 x86 版本,如果没有看到,则会给出类似这样的错误。 x64 版本可能足够智能,可以检查任一版本,尽管您可能会遇到相同的情况。

ODBC 也会发生同样的情况 - x86 和 x64 数据源不可用于其他类型的应用程序 - 如果您希望某些内容在两个版本的应用程序中都可见,则需要在每个版本的管理工具中创建 ODBC 源。

Could it be a problem with x86/x64? If the workstation in question is x64, and you've installed the x64 version of the client, but the application you're trying to run is in the x86 space, you may need the x86 version of the client on that workstation as well. An x86 app will only check for an x86 version of the provider, and seeing none, will give an error like this one. The x64 version is probably smart enough to check for either version, though maybe you'd have the same situation.

This same thing happens with ODBC - x86 and x64 data sources aren't available to the other type of application - if you want something to be visible from both builds of applications, you'll need to create an ODBC source in each version's Admin tool.

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