Monday, March 19, 2012

Connecting to local cube created from AS 2000 and AS 2005 cubes using ADOMD.NET 9.0

Hello,

I created two local cubes, first one: from an AS 2000 cube and the second one from an AS 2005 cube. Then I tried to connect to them using the following code:

' AS 2000

Dim strDataSource As String = "MyFolderPath\AS2000LocalCube.cub"

Dim strDatabase As String = "AS2000LocalCubeName"

' AS 20005

'Dim strDataSource As String = "MyFolderPath\AS2005LocalCube.cub"

'Dim strDatabase As String = "AS2005LocalCubeName"

strConnectString = "Provider=MSOLAP;Data Source=" & strDataSource & ";Catalog=" & strDatabase & ";MDX Compatibility=2;"

Dim clConnection As New AdomdConnection

clConnection.ConnectionString = strConnectString

clConnection.Open()

It works properly for AS 2000 local cube but for AS 20005 local cube, it return the following exception:

InnerException{"The 'MyFolderPath\AS2005LocalCube.cub' local cube file cannot be opened."}System.Exception

Message"A connection cannot be made. Ensure that the server is running."String

Source"Microsoft.AnalysisServices.AdomdClient"String

StackTrace"at Microsoft.AnalysisServices.AdomdClient.XmlaClient.Connect(ConnectionInfo connectionInfo, Boolean beginSession)

at Microsoft.AnalysisServices.AdomdClient.AdomdConnection.XmlaClientProvider.Microsoft.AnalysisServices.AdomdClient.AdomdConnection.IXmlaClientProviderEx.ConnectXmla()

at Microsoft.AnalysisServices.AdomdClient.AdomdConnection.ConnectToXMLA(Boolean createSession, Boolean isHTTP)

at Microsoft.AnalysisServices.AdomdClient.AdomdConnection.Open()

Both local cubes were created using the same MDX query.

Abdel

Can you connect to the AS2005 local cube using OLEDB. Excel and the MDX Sample app both use OLEDB, so try one of these.

Try getting rid of MDX Compatibility=2... shouldn't matter.

How did you create the local cube?

|||

Yes I am able to connect using MDX Sample App and Excel 2003.

But for AS 2005 local cube and using Excel 2003, if you are already connected to the file using MDX Sample App, the following message is returned: “AS2005LocalCube.cub’ cannot be accessed. The file may be read-only, or you may be trying to access a read-only location. Or, the server the document is stored on may not be responding”.

I create the local cube with the following MDX query:

CREATE GLOBAL CUBE [AS2005LocalCube]

STORAGE 'MyFolderPath\AS2005LocalCube.cub'

FROM [2005SQLServerCube] (

MEASURE [2005SQLServerCube].[Value1],

MEASURE [2005SQLServerCube].[Value1_Footnote1] HIDDEN ,

MEASURE [2005SQLServerCube].[Value1_Footnote2] HIDDEN ,

MEASURE [2005SQLServerCube].[Value2],

DIMENSION [2005SQLServerCube].[GenderDim].[Genders] (

LEVEL [(All)], LEVEL [Genders]

),

DIMENSION [2005SQLServerCube].[ProductDim].[Products] (

LEVEL [(All)], LEVEL [Products]

)

)

|||In AS2005 only one process at a time can open local cube file. This is why if you are already connected in Excel - you won't be able to connect from MDX Sample App.

No comments:

Post a Comment