Search code examples
c#mondrianadomd.net

AdomdConnection connection to mondrian from C#


I am facing issue while connecting to mondrian from C# application. Below is my dev environment.

  1. Visual Studio version - 2015
  2. Mondrian - mondrian-3.11.1.0-386
  3. Tomcat - apache-tomcat-7.0.62

I have followed the same steps as mentioned here. Installed SQLSERVER2008_ASADOMD10.msi (6926 KB) as I am using Windows 7 64 bit OS.

EDIT In that link, they have NOT mentioned for Visual Studio 2015 Applications. Is it not supported for Visual Studio 2015 ?

Below is my code;

public DataTable GetMondrianData(string mdxQuery)
{
   string connectionString = "Data Source=http://localhost:8080/mondrian/xmla; Initial Catalog=FoodMart;";
   using (AdomdConnection con = new AdomdConnection(connectionString))
   {
      try
      {
         con.Open();

         AdomdCommand cmd = new AdomdCommand(mdxQuery, con);
         AdomdDataAdapter da = new AdomdDataAdapter(cmd);
         DataSet dsMondrian = new DataSet();
         da.Fill(dsMondrian, "olap");
         return dtResult;
      }
      catch (Exception ex)
      {
         throw new Exception("An error occurred while fetching mondrian data " + ex.Message);
      }
   }
}

In con.Open(); I am getting {"Element 'return' was not found. Line 7, position 4."} error.

Please let me know how to resolve this issue.

Regards Vishwanath


Solution

  • ADOMD doesn't work with mondrian, because Mondrian developers cut off service for this. They are also remove web app. I use XMondrian base on Mondrian 3.12 with web app. You will need connect to the mondrian via HTTP, write parser for XML answear and write .NET provider for this.