ADOMD.net 和 Analysis Services OLE DB 提供程序之间的差异(特别是在身份验证方面)

发布于 2024-10-07 03:35:12 字数 1066 浏览 0 评论 0原文

我正在尝试连接到远程服务器上的 SQL Server Analysis Services 多维数据集,该服务器未连接到我所连接的域。

提供用户名和密码后,我可以使用 Excel 连接到多维数据集。现在我尝试通过代码连接到同一个多维数据集。

通过 AdomdConnection 连接失败

使用 SQL Server 2008 R2 的 ADOMD.net (AdomdConnection) 我尝试使用此连接字符串进行连接:

Data Source=SRV1;Initial Catalog=Name of Cube;User Id=RemoteAccount;Password=***

此连接在连接的 Open 方法上失败。 有趣的是,“用户 ID”和“密码”属性是允许的,因为如果语法错误,您会收到 KeyNotFoundException。

通过 OleDbConnection 成功连接

如果我使用,我可以成功连接相反,OleDbConnection 和以下连接字符串(从 Excel 连接复制):

Provider=MSOLAP.4;Persist Security Info=True;User ID=SRV1;Password=***;Initial Catalog=Name of Cube;Data Source=SRV1;

所以我的问题是:

  • 有人可以解释这种行为吗?我以为AdomdConnection只是在底层使用了OleDB?
  • 有没有办法连接到 SSAS 带有 AdomdConnection 的实例使用 用户名和密码?
  • 有没有 之间的进一步差异 AdomdConnection 和 OleDbConnection?

所有下载均可在此处获取。

I'm attempting to connect to a SQL Server Analysis Services cube on a remote server which is not connected to the domain I'm connected to.

I can connect to the cube with Excel after providing username and password. Now I'm trying to connect to the same cube via code.

Unsuccessful connection via AdomdConnection

Using ADOMD.net (AdomdConnection) for SQL Server 2008 R2 I try to connect with this connection string:

Data Source=SRV1;Initial Catalog=Name of Cube;User Id=RemoteAccount;Password=***

This connection fails on the Open method of the connection. Interestingly the "user id" and "password" properties are allowed, because if the syntax was wrong you get a KeyNotFoundException.

Successful connection via OleDbConnection

I can successfully connect if I use OleDbConnection instead and the following connection string (copied from the Excel connection):

Provider=MSOLAP.4;Persist Security Info=True;User ID=SRV1;Password=***;Initial Catalog=Name of Cube;Data Source=SRV1;

So my questions are:

  • Can someone explain this behaviour? I thought AdomdConnection just used OleDB underneath?
  • Is there a way to connect to a SSAS
    instance with AdomdConnection using
    username and password?
  • Are there any
    further differences between
    AdomdConnection and OleDbConnection?

All downloads are available here.

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

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

发布评论

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

评论(2

山人契 2024-10-14 03:35:12

我成功地将 AdomdConnection 与用户名/密码密钥一起使用,但不同之处在于我正在连接到 HTTP 数据源。我使用的解决方案是通过 IIS 7 通过 HTTP 传输 OLAP 流量,如下所述 在 MSDN 中。然后,IIS 将用户名和密码模拟为 Windows 凭据。

注意:在 IIS 中禁用匿名和 Windows 身份验证。我只能使用基本身份验证才能使用它。为了增强安全性,请使用 SSL。

I'm using the AdomdConnection succesfully with the username / password keys, but the difference is that I'm connecting to a HTTP data source. The solution I'm using is that I tunnel OLAP traffic over HTTP via IIS 7 as described in MSDN. The user name and password are then impersonated by IIS to Windows credentials.

Note: Disable Anonymous and Windows Authentication in IIS. I only got it working with Basic Authentication. For enhanced security, use SSL.

铁轨上的流浪者 2024-10-14 03:35:12

如果无法将cube与excel连接起来,那么就无法将其与代码连接起来。

ADOMD.Net 和 OleDb 连接之间的区别在于,OleDb MSOLAP 提供程序可用于将 MDX、DAX 和 DMX 查询发送到 Analysis Services 数据库。结果只能是标量或表,因此您不能使用在两个以上轴上返回结果的 MDX 查询。当您使用 DAX 查询时,结果总是适合表,您可以使用 DataReader 类来获取结果。

由于存在 连接错误尚未解决。

为了使用 ADOMD.NET 连接到 SSAS 实例,我们需要在 web.config 文件中添加以下行(在 Visual studio 2012 中创建控制台应用程序后)

由于我们将使用 Windows 身份验证连接到 Microsoft Analysis Services 2005,因此需要在 web.config 文件中添加这一行来模拟有权访问 Analysis Services 的用户。

我们需要通过创建新的应用程序池来配置 IIS 服务器。

以下 MSDN 链接将提供 ADOMD.NET 连接字符串的其他参数。

https://msdn.microsoft.com/en-us /library/microsoft.analysisservices.adomdclient.adomdconnection.connectionstring

If you cannot connect the cube with excel, then you cannot connect it with the code.

The difference between ADOMD.Net and OleDb connection is that, the OleDb MSOLAP provider can be used to send MDX, DAX and DMX queries to an Analysis Services database. The result can only be a scalar or a table, so you cannot use an MDX query returning results on more than two axes. When you use a DAX query, the result will always fit well in a table, you can use a DataReader class to get the result.

We prefer mainly ADOMD.NET on OleDb due to the presenceConnection bug which hasn't been resolved.

In order to connect to SSAS instance with ADOMD.NET we need to add the following line in web.config file ( After creation of console application in Visual studio 2012)

Since we will be using Windows authentication to connect to Microsoft Analysis Services 2005, this addition of line in the web.config file is required to impersonate a user having access to the Analysis Services.

We need to configure the IIS server by creating a new application pool.

Following MSDN link will give other parameters of the ADOMD.NET connection String.

https://msdn.microsoft.com/en-us/library/microsoft.analysisservices.adomdclient.adomdconnection.connectionstring

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