使用 VSDBCMD.exe 创建 dbschema 文件时出错

发布于 2024-09-28 22:53:11 字数 2498 浏览 1 评论 0 原文

我有一个 VS 2010 数据库项目,需要对 Dynamics CRM 数据库的数据库引用。我可以远程访问 32 位 Windows 2003 R2 SP2 服务器。我的策略是创建一个 .dbschema 文件并将其用作参考。

我找到的用于创建 .dbschema 文件的两个最佳资源来自 stackoverflowMSDN

我收到的错误是:

无法根据提供的连接字符串确定数据库架构提供程序。检查连接字符串对于用于数据库提供程序的 ADO.NET 提供程序是否有效,以及您是否具有连接到服务器所需的权限。

我所做的步骤是:

  1. 创建一个临时文件夹 C:\temp
  2. 将文件夹 C:\Program Files (x86)\Microsoft Visual Studio 10.0\VSTSDB\Deploy 的内容复制到 C:\temp
  3. 从下面的列表中复制一些 DLL文件夹 C:\Program Files (x86)\Microsoft SQL Server Compact Edition\v3.5 到 C:\temp

此时,MSDN 说明说我应该拥有文件

  • DatabaseSchemaProviders.Extensions.xml
  • Microsoft.Data.Schema.dll
  • Microsoft .Data.Schema.ScriptDom.dll
  • Microsoft.Data.Schema.ScriptDom.Sql.dll
  • Microsoft.Data.Schema.Sql.dll
  • Microsoft.SqlServer.BatchParser.dll
  • Sqlceer35en.dll
  • Sqlceme35.dll
  • Sqlceqp35.dll
  • Sqlcese35.dll
  • System.Data .SqlServerCe.dll
  • VSDBCMD.EXE

这几乎是正确的。

  • DatabaseSchemaProviders.Extensions.xml 实际上位于 C:\temp\Extensions\SqlServer\ 中,因此我也将其复制到 C:\temp 以防它需要位于同一目录级别
  • Microsoft.SqlServer.BatchParser.dll 是在 GAC 中找到,所以大概我不需要将其复制到 C:\temp,但我还是这样做了,采用了 32 位版本,因为我的其他 DLL 来自 Program Files (x86)。

  • 我尝试从 C:\temp 本地运行 VSDBCMD,并以管理员身份运行 CMD。我还将 C:\temp 复制到服务器并尝试在那里运行它。

VSDBCMD /a:导入 /cs:"Provider=SQLOLEDB.1;密码=********;持久安全信息=True;用户 ID=sa;初始目录=VANILLA_MSCRM;数据源=** ******" /dsp:Sql /model:VANILLA_MSCRM.dbschema

我已经尝试了数据源 = {., (本地), localhost, IP 地址, 计算机名称, 域名} 与 Providers = {SQLOLEDB. 1、SQLNCLI10.1、SQLNCLI.1}。所有结果都会导致相同的错误。显然 ., (local) 和 localhost 仅在从服务器运行时使用。我通过 UDL 文件构建连接字符串来测试它们 (\http://msdn.microsoft.com/en-us/library/e38h511e%28VS.71%29.aspx)。正如这篇文章所建议的 \ http://social.msdn.microsoft.com/Forums/en-US/vstsdb/thread/dabd14fa-a805-4855-b3f1-33b37b16c5b1 我尝试了 sqlcmd 并可以成功运行它。

我该如何解决这个问题?我创建 .dbschema 文件来引用 CRM 数据库的策略是否错误?

I have a VS 2010 database project that needs a database reference to a Dynamics CRM database. I have remote access to the 32-bit Windows 2003 R2 SP2 server. My strategy is to create a .dbschema file and use it as the reference.

The two best resources I have found for creating the .dbschema file are from stackoverflow and MSDN.

The error I received is:

The database schema provider could not be determined from the supplied connection string. Check if the connection string is valid for the ADO.NET provider used for your database provider and that you have the privileges necessary to connect to the server.

The steps I have done are:

  1. Create a temporary folder C:\temp
  2. Copy contents of folder C:\Program Files (x86)\Microsoft Visual Studio 10.0\VSTSDB\Deploy to C:\temp
  3. Copy some DLLS from the list below of the folder C:\Program Files (x86)\Microsoft SQL Server Compact Edition\v3.5 to C:\temp

At this point the MSDN instructions say that I should have the files

  • DatabaseSchemaProviders.Extensions.xml
  • Microsoft.Data.Schema.dll
  • Microsoft.Data.Schema.ScriptDom.dll
  • Microsoft.Data.Schema.ScriptDom.Sql.dll
  • Microsoft.Data.Schema.Sql.dll
  • Microsoft.SqlServer.BatchParser.dll
  • Sqlceer35en.dll
  • Sqlceme35.dll
  • Sqlceqp35.dll
  • Sqlcese35.dll
  • System.Data.SqlServerCe.dll
  • VSDBCMD.EXE

This is almost true.

  • DatabaseSchemaProviders.Extensions.xml is actually located in C:\temp\Extensions\SqlServer\ so I also copied it to C:\temp in case it needs to be at the same directory level
  • Microsoft.SqlServer.BatchParser.dll was found in the GAC, so presumably I don't need to copy it to C:\temp but I did so anyways, taking the 32-bit version because my other DLLs came from Program Files (x86).

    1. I tried running VSDBCMD locally from C:\temp with CMD run as administrator. I have also copied C:\temp to the server and tried running it there.

VSDBCMD /a:Import /cs:"Provider=SQLOLEDB.1;Password=********;Persist Security Info=True;User ID=sa;Initial Catalog=VANILLA_MSCRM;Data Source=********" /dsp:Sql /model:VANILLA_MSCRM.dbschema

I have tried all combinations of Data Sources = {., (local), localhost, the IP address, the machine name, the domain name} with Providers = {SQLOLEDB.1, SQLNCLI10.1, SQLNCLI.1}. All result in the same error. Obviously ., (local) and localhost were only used when ran from the server. I tested my connection strings by building them via UDL files (\http://msdn.microsoft.com/en-us/library/e38h511e%28VS.71%29.aspx). As suggested by this post \http://social.msdn.microsoft.com/Forums/en-US/vstsdb/thread/dabd14fa-a805-4855-b3f1-33b37b16c5b1 I tried sqlcmd and could successfully run it.

How can I troubleshoot this problem? Is my strategy of creating a .dbschema file to reference my CRM database a wrongheaded approach?

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

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

发布评论

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

评论(1

对风讲故事 2024-10-05 22:53:11

我也尝试过这个,发现以下内容对我有用(从 VS2010 命令提示符运行,并使用对数据库具有 sysadmin 权限的帐户运行):

vsdbcmd /action:import /connectionstring:"Integrated Security=True;Data Source=<SERVER>;Initial Catalog=<DATABASE>" /modelfile:"<DATABASE>.dbschema"

I've tried this too, and found the following worked for me (run from the VS2010 command prompt, and run using an account that has sysadmin priviledges on the database):

vsdbcmd /action:import /connectionstring:"Integrated Security=True;Data Source=<SERVER>;Initial Catalog=<DATABASE>" /modelfile:"<DATABASE>.dbschema"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文