Create Cube files from an SqlConnection

R

roger.camargo

The title says everything.
Well not just an SqlConnection, what about other native .NET data
providers.
or using System.Data.Odbc.OdbcConnection
or System.Data.OleDb.OleDbConnection
 
R

roger.camargo

Well, at least someone tell me if this is imposible. please..... this
could save my life.
 
B

BizWorld

You can use an existing OLEDB Provider for Olap Services to connect with
cubes. If you dont know how to do it then create an ODBC connection.
 
R

roger.camargo

I'm accesing a MySQL database.

If I only have access to the .NET data provider for mysql called
ByteFX.MySqlClient and not to the ODBC Provider

Can I create the cube file with just the
ByteFX.MySqlClient.Connection object
or
SqlConnection.Connection.
I think the answer could apply for both



Another question.
I'd tried to use OLEDB ODBC DSN less connection.

A simple connection looks something like this:

ADODB.Connection con = new ADODB.Connection();
con.ConnectionString = "Provider=MSDASQL.1;Extended
Properties=\"DRIVER={MySQL ODBC 3.51
Driver};SERVER=127.0.0.1;PORT=;OPTION=3;DATABASE=database;USER=root\""

and it works to connect.


But I'm trying to use this ConnectionString in the creation of a Local
Cube:

string sConnection=null;
string sLocation=null;
string sSourceDSN=null;
string sCreateCube=null;
string sInsertInto=null;

ADODB.Connection adocon = new ADODB.Connection();
sLocation = @"LOCATION= c:\cubes\cube.cub";

//Here is where I want to use the previous DSN Less connection
sSourceDSN = "SOURCE_DSN=\"Provider=MSDASQL.1;Extended
Properties=\"DRIVER={MySQL ODBC 3.51
Driver};SERVER=127.0.0.1;PORT=3306;OPTION=3;DATABASE=database;USER=root\"\"";

//This is using a ODBC DSN that I don't want
//unless it can be created programatically
//sSourceDSN = "SOURCE_DSN=myCubeDBTarget";

sCreateCube = @"
CREATECUBE=CREATE CUBE cubetest
(
DIMENSION[Place],
LEVEL[ALL Place] TYPE ALL,
LEVEL[Country],
LEVEL[City],
DIMENSION[Product],
LEVEL[All Product] TYPE ALL,
LEVEL[Category],
LEVEL[Name],
MEASURE[Quantity] FUNCTION SUM Format '#,#'
)
";
sInsertInto = @"
INSERTINTO=INSERT INTO cubetest
(
Lugar.[Country],
Lugar.[City],
Producto.[Category],
Producto.[Name],
Measures.[Quantity]
)";

sInsertInto += @"
SELECT
c.Country,
c.City,
c.Category,
c.Product,
c.Quantity
FROM
cubetest c
";

sConnection = sLocation + ";" + "\n" + sSourceDSN + ";" + "\n" +
sCreateCube + ";" + "\n" + sInsertInto;

adocon.ConnectionString = sConnection;
adocon.Provider = "MSOLAP";
adocon.Open(sConnection,"","",0);



Well I hope someone could clear this 2 questions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top