Showing posts with label objects. Show all posts
Showing posts with label objects. Show all posts

Wednesday, March 21, 2012

Retrieving OLAP Cube Names from AM2000

Hello,
I am trying to retrieve the Cube names from Analysis Manager 2000 by using DSO objects in VS2005.NET C# 2.0 ( framework 2.0)

The code is something like that.
DSO.Server srv = new DSO.Server();
srv.Connect("localhost");

after that i do not what to do in order to get the cube names from AM2000.
when i do the following

srv.MDStore.Count

i can get the number of the cubes but i cant get the names.
I tried to use the following method but did not work out.

srv.MDStore.Item(object vntIndexKey)

May be i do not know how to use the above method to get the cube names.

for(int i = 0; i < srv.MDStore.Count; i++)
combobox1.Item.Add(srv.MDStore.Item(i).ToString());

the above code does not add the cube names into combobox, either. Sad(

Please somebody help me with this problem.
I need to get the cube names from the AM2000 to let the user choose what cube he/she wants to work with!?

thanks in advance

best regards

Tunc OVACIK

DSO is the wrong API to use for something ordinary users need to run. DSO is the admin API and will only work for OLAP Administrators.

You should use the ADOMD or ADOMD.NET api, the MDX Sample app has code that does this using the older ADOMD API.

There is a sample in BOL for using ADOMD.NET to get a list of cubes which I have copied out below, the original page is available here

ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/adodw9/html/0183dcdc-f2ea-4246-ad00-6e8ccc9d8217.htm

Code Snippet

private string RetrieveCubesAndDimensions()
{
System.Text.StringBuilder result = new System.Text.StringBuilder();

//Connect to the local server
using (AdomdConnection conn = new AdomdConnection("Data Source=localhost;"))
{
conn.Open();

//Loop through every cube
foreach (CubeDef cube in conn.Cubes)
{
//Skip hidden cubes.
if (cube.Name.StartsWith("$"))
continue;

//Write the cube name
result.AppendLine(cube.Name);

//Write out all dimensions, indented by a tab.
foreach (Dimension dim in cube.Dimensions)
{
result.Append("\t");
result.AppendLine(dim.Name);
}
}

//Close the connection
conn.Close();
}

//Return the results
return result.ToString();
}

|||

Hello again,

I have succedded to get the cube names from AM2000 by using DSO API. To do this job with DSO API is very easy.

For further information for the others who may need it I will give the sample code.

string[] cubeNames;

DSO.Server dsoServer = new DSO.Server();

dsoServer.Connect("localhost");

// Count will return the number of cubes on AM2000

cubeNames = new string[dsoServer.MDStore.Count];

int i = 0;

foreach( DSO.MDStore cube in dsoServer.MDStore)

{

cubeNamesIdea = cube.Name;

i++;

}

Before going through the code you should add the relevant .dll file into your project from the "Add Reference" menu.

Actually it is possible to get the cube names by using ADOMD classes as well as Darren said. I thank you for your help which was really usefull. So, the next step for me is to go through the cube and get the neccesarry data I need to make report for the user.

thanks for everything

Tunc OVACIK

|||The DSO code will only work for administrators, you can run it because you are an admin, normal users will not be able to run it. Hence the reason I suggested using Adomd.

Retrieving OLAP Cube Names from AM2000

Hello,
I am trying to retrieve the Cube names from Analysis Manager 2000 by using DSO objects in VS2005.NET C# 2.0 ( framework 2.0)

The code is something like that.
DSO.Server srv = new DSO.Server();
srv.Connect("localhost");

after that i do not what to do in order to get the cube names from AM2000.
when i do the following

srv.MDStore.Count

i can get the number of the cubes but i cant get the names.
I tried to use the following method but did not work out.

srv.MDStore.Item(object vntIndexKey)

May be i do not know how to use the above method to get the cube names.

for(int i = 0; i < srv.MDStore.Count; i++)
combobox1.Item.Add(srv.MDStore.Item(i).ToString());

the above code does not add the cube names into combobox, either. Sad(

Please somebody help me with this problem.
I need to get the cube names from the AM2000 to let the user choose what cube he/she wants to work with!?

thanks in advance

best regards

Tunc OVACIK

DSO is the wrong API to use for something ordinary users need to run. DSO is the admin API and will only work for OLAP Administrators.

You should use the ADOMD or ADOMD.NET api, the MDX Sample app has code that does this using the older ADOMD API.

There is a sample in BOL for using ADOMD.NET to get a list of cubes which I have copied out below, the original page is available here

ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/adodw9/html/0183dcdc-f2ea-4246-ad00-6e8ccc9d8217.htm

Code Snippet

private string RetrieveCubesAndDimensions()
{
System.Text.StringBuilder result = new System.Text.StringBuilder();

//Connect to the local server
using (AdomdConnection conn = new AdomdConnection("Data Source=localhost;"))
{
conn.Open();

//Loop through every cube
foreach (CubeDef cube in conn.Cubes)
{
//Skip hidden cubes.
if (cube.Name.StartsWith("$"))
continue;

//Write the cube name
result.AppendLine(cube.Name);

//Write out all dimensions, indented by a tab.
foreach (Dimension dim in cube.Dimensions)
{
result.Append("\t");
result.AppendLine(dim.Name);
}
}

//Close the connection
conn.Close();
}

//Return the results
return result.ToString();
}

|||

Hello again,

I have succedded to get the cube names from AM2000 by using DSO API. To do this job with DSO API is very easy.

For further information for the others who may need it I will give the sample code.

string[] cubeNames;

DSO.Server dsoServer = new DSO.Server();

dsoServer.Connect("localhost");

// Count will return the number of cubes on AM2000

cubeNames = new string[dsoServer.MDStore.Count];

int i = 0;

foreach( DSO.MDStore cube in dsoServer.MDStore)

{

cubeNamesIdea = cube.Name;

i++;

}

Before going through the code you should add the relevant .dll file into your project from the "Add Reference" menu.

Actually it is possible to get the cube names by using ADOMD classes as well as Darren said. I thank you for your help which was really usefull. So, the next step for me is to go through the cube and get the neccesarry data I need to make report for the user.

thanks for everything

Tunc OVACIK

|||The DSO code will only work for administrators, you can run it because you are an admin, normal users will not be able to run it. Hence the reason I suggested using Adomd.

Friday, March 9, 2012

Retrieveing objects

Dears,
I created a table, then dropped it by mistake. Is there any way to retrieve it back using the log file? The lat DB backup was made before creating the table.
Thanks,1. Take a log backup
2. make another database and restore the previous full backup over there as you would not want to make any changes to the original db
3. restore transaction log to a time before you dropped the table
4. copy table onto original database

tell me if you need any other help|||When applying the backup, through the Enterprise Manager, I had the "Point in time restore" option disabled. Have an idea why? Do you think making the backup through the T-SQL better?

Originally posted by Enigma
1. Take a log backup
2. make another database and restore the previous full backup over there as you would not want to make any changes to the original db
3. restore transaction log to a time before you dropped the table
4. copy table onto original database

tell me if you need any other help|||Question : What is your database recovery model

Simple , Full or Bulk Logged

Give me a list of the things you have done till now ...

Wednesday, March 7, 2012

Retrieve SQL Server data via MS Query to spreadsheet

Hi,
Here is a security question: what way can I restrict the access to SQL
Server 2005 database objects ?
I'm going to let some my users use some tables, views to create their own
MSQuery queries to retrieve data from SQLServer, but not all ones! (I have
hundreds of tables, views, sprocs...)
What is the bast practices both from server side and Excel-side for this
kind of restriction ?
Thanks,
szabtiBest thing is to create a special login in sql server and grant the user to
have permission only to those tables.
These permission depends on what all privileges you want to grant them, if
its simple select , them give only db_datareader access
vt
"szabti" <tibor.szabo@.iconsulting.hu> wrote in message
news:uANKaC4FHHA.5004@.TK2MSFTNGP03.phx.gbl...
> Hi,
> Here is a security question: what way can I restrict the access to SQL
> Server 2005 database objects ?
> I'm going to let some my users use some tables, views to create their own
> MSQuery queries to retrieve data from SQLServer, but not all ones! (I have
> hundreds of tables, views, sprocs...)
> What is the bast practices both from server side and Excel-side for this
> kind of restriction ?
>
> Thanks,
> szabti
>|||szabti
Security is a huge subject especially in SQL Server 2005. I'd suggest to
spend a few days to study it .BOL is good place to start.
"szabti" <tibor.szabo@.iconsulting.hu> wrote in message
news:uANKaC4FHHA.5004@.TK2MSFTNGP03.phx.gbl...
> Hi,
> Here is a security question: what way can I restrict the access to SQL
> Server 2005 database objects ?
> I'm going to let some my users use some tables, views to create their own
> MSQuery queries to retrieve data from SQLServer, but not all ones! (I have
> hundreds of tables, views, sprocs...)
> What is the bast practices both from server side and Excel-side for this
> kind of restriction ?
>
> Thanks,
> szabti
>