First of all, we will need to install the ODBC driver for Oracle BI Server on the machine from where we are trying to access it. Refer the guide Installing Oracle BI Open Intelligence Interface to do this. Next we need to create ODBC DSN. I explained the steps to do this in one of my earlier post Switch OBIEE Repository and Catalog. Now you are ready to code your windows application.
Launch the Microsoft Visual Studio and create new C# Windows Forms Application.
From the tools pane drag-n-drop DataGridView control over the Form and align it as needed. Visual Studio will name it dataGridView1 by default.
In the code-behind of the form, add using directive for System.Data.Odbc namespace.
Now lets add code to execute query over BI Server and get the output. In the form's load event include following code.
In the connection string, DSN name should match the name of ODBC DSN you created. Provide appropriate user id and password.
string constring = "DSN=AnalyticServer;UID=Administrator;Pwd=Administrator";
Create ODBC connection using connection string.
OdbcConnection con = new OdbcConnection(constring);
The query should contain select statment that you intend to execute against BI Server.
string query = "SELECT statement";
Create OdbcDataAdapter using query and connection. Create a DataSet to hold results. Execute query using Fill method.
OdbcDataAdapter da = new OdbcDataAdapter(query, con);
DataSet ds = new DataSet();
da.Fill(ds);
The dataset returned will contain a Table with results. Bind this table to the dataGridView1.
dataGridView1.DataSource = ds.Tables[0];
Now build and run the project and you should see output of the query in the grid.
Oracle BI ODBC Client executes queries in the similar way. However, it is not a .NET application.