我有一个 VS 2010 数据库项目,需要对 Dynamics CRM 数据库的数据库引用。我可以远程访问 32 位 Windows 2003 R2 SP2 服务器。我的策略是创建一个 .dbschema 文件并将其用作参考。
我找到的用于创建 .dbschema 文件的两个最佳资源来自 stackoverflow 和 MSDN。
我收到的错误是:
无法根据提供的连接字符串确定数据库架构提供程序。检查连接字符串对于用于数据库提供程序的 ADO.NET 提供程序是否有效,以及您是否具有连接到服务器所需的权限。
我所做的步骤是:
- 创建一个临时文件夹 C:\temp
- 将文件夹 C:\Program Files (x86)\Microsoft Visual Studio 10.0\VSTSDB\Deploy 的内容复制到 C:\temp
- 从下面的列表中复制一些 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
这几乎是正确的。
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:
- Create a temporary folder C:\temp
- Copy contents of folder C:\Program Files (x86)\Microsoft Visual Studio 10.0\VSTSDB\Deploy to C:\temp
- 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).
- 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?
发布评论
评论(1)
我也尝试过这个,发现以下内容对我有用(从 VS2010 命令提示符运行,并使用对数据库具有 sysadmin 权限的帐户运行):
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):