Friday, February 24, 2012

Local cubes connection

Hello,
I have created 3 local cubes which resided in the same .cub file. The cubes created from AS 2005 cubes.
How can I make ADOMD connection to all 3 cubes at the same time in my client application (C#)?
The problem is that Initial Catalog (database name) in connection string in case of local cubes is the same as the cube name.

Thanks,
GB

In ADOMD you don't connect directly to any specific cube. Once you have connect to the database (catalog) you just specify which cube you want in the query. So you only need the one connection and you can use that to query any of the cubes in the catalog.

eg

SELECT measures.AllMembers ON COLUMNS FROM <CUBE_NAME>

|||

I think GB meant that the problem was that since for him database name and the cube name are the same - he ended up with 3 different databases, and ADOMD only works with one database at the time.

However, the limitation of database name being the same as the cube name only existed in AS2000, and also AS2000 officially only supports one cube per database. These limitations don't exist in AS2005.

|||That makes sense, If I had to create a local cube I would use the ASSL syntax, but if I am not mistaken the CREATE LOCAL CUBE (which is depreciated) and CREATE GLOBAL CUBE methods setup the database with the same name as the cube. There is a reasonable white paper on local cubes which contrasts the different methods of creating them here http://www.localcubetask.com/UsingLocalCubesinMicrosoftSQLServer2005AnalysisServices.doc|||

I have cteated my local cubes using ASSL CGC method in SSMS 2005.

I created 3 cubes: Cube1,Cube2,Cube3 in one My_cubes.cub file.

In my C# code application I have the following connection string:

string myConnectionString = "Provider=MSOLAP;Data Source='C:\\LOCALCUBES\\My_cubes.cub';Initial Catalog=Cube1";

When I try to get dimensions from Cube2 I 'v got an error related to the connection string - no connection to Cube2.

I tryed to create 2 saparate connection strings for the same My_cubes.cub file but different cubes, but application can not open same file twice.

So, I still have a problem to open connection to 2 local cubes at the same time.

Thanks,

GB

|||The solution that was suggested above, is to build real XMLA scripts to create your cubes instead of using CREATE GLOBAL CUBE statement - this way you will be able to put multiple cubes in the same database in the local cube.|||

Yes, XMLA script is working for me.

I found the instructions hear:

http://cwebbbi.spaces.live.com/blog/cns!7B84B0F2C239489A!883.entry

Thanks,

GB

|||

Still have the problem.

My local .cub file created by XMLA script contains 3 databases with 7 cubes each.

When I open this .cub file in MDX Sample application I can make

a connection and MDX query to any of 3 databases and accordingly their cubes.

But in my C# application when I try open connection to all local databases in a loop from the same .cub file

I got the error just after attampting to open second database in a loop.This is ADOMDClient.AdomdConnection error:

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

Any hints how to fix the problem?

Thanks,

GB

|||

You can only have one connection to the local cube file - therefore the second connection fails. Your options:

1. Split it to the 3 different local cube files

2. Put all the cubes in the same database

3. Close the previous connection before opening a new one

4. Keep one connection, but change the current database when you need to go to another one.

No comments:

Post a Comment