BI Java SDK Examples
The BI Java SDK provides examples of using its Relational and OLAP APIs.
This page allows you to view source and result of each example, and explains
how to configure your system to work with the examples, in the following
sections:
Viewing the Examples
Following the links in the table below, you can view the source code
and code comments of example Java files reproduced in HTML format ("view
source"). You may also view the HTML stream of the result ("view result").
The two Tutorial examples form the basis for the Getting Started chapter
in the Developer's Guide ( ).
Tutorial_1.java:
view source
view result |
Getting Started - OLAP Tutorial
Contains a complete end-to-end scenario, demonstrating how to connect
to a BW system using the BI XMLA Connector, retrieve a cube from the
data source, create a query, execute it, and render the result set
into an HTML table. |
Tutorial_2.java:
view source
view result |
Getting Started - Relational Tutorial
Contains a complete end-to-end scenario, demonstrating how to connect
to a JDBC database using the BI JDBC Connector, retrieve a table from
the data source, create a query, execute it, and render the result
set into an HTML table. |
Olap_1.java:
view source
view result |
OLAP 1 - Accessing OLAP metadata
Demonstrates four different ways to retrieve OLAP metadata:
- Via connection-level methods
- Via ObjectFinder methods
- Via JMI methods
- Via member data access methods
|
Olap_2.java:
view source
view result |
OLAP 2 - Direct execution of MDX statement
Demonstrates how to retrieve a result set by directly executing an
MDX statement, then shows how to display the result set as an HTML
table. |
Olap_3.java:
view source
view result |
OLAP 3 - Pivoting / changing layout of an OLAP
query
Illustrates the process of changing the layout of a query by moving
dimensions between axes and then by swapping axes. Renders the output
of each into two separate HTML tables. |
Olap_4.java:
view source
view result |
OLAP 4 - Selecting dimension attributes
Selects a dimension attribute, and renders the result set into an
HTML table. |
Olap_5.java:
view source
view result |
OLAP 5 - Sorting by measure value
Renders the default result set into an HTML table, sorts the data
according to a measure value in ascending order, and then renders
the data into a second HTML table for comparison. |
Olap_6.java:
view source
view result |
OLAP 6 - Sorting by dimension attribute
Illustrates how to select a dimension attribute for display, and to
sort by a dimension attribute. |
Olap_7.java:
view source
view result |
OLAP 7 - Filtering
Illustrates both a ranking filter and a condition-based filter. Renders
the result of a query without any filtering, then filters the set
of Sold-To parties using a ranking filter and re-renders the result.
Changes the filter to a condition-based filter to restrict by quantity,
and re-renders the result for comparison. |
Olap_8.java:
view source
view result |
OLAP 8 - Hierarchy navigation - member drill
operations
Illustrates hierarchy navigation by applying the following operations
in sequence to an initial data set:
- Zoom in
- Zoom out
- Drill down
- Drill up
After each operation, the result set is rendered again for comparison.
|
Olap_9.java:
view source
view result |
OLAP 9 - Calculated members
Creates a calculated measure - cost per item - by dividing the total
cost by the number of items sold. |
Olap_10.java:
view source
view result |
OLAP 10 - SAP variable selection and editing
Illustrates retrieval of and effect of editing an SAP variable. Sets
a value for an optional SAP variable, renders the result of the default
query into a table, searches for a specific optional SAP variable
using the OLAP object finder, changes its value, and then re-renders
the result into a new table for comparison. |
Relational_1.java:
view source
view result |
Relational 1 - Accessing relational metadata
Illustrates the process of retrieving relational metadata from catalog
to column from a JDBC data source. |
Relational_2.java:
view source
view result |
Relational 2 - Accessing relational metadata:
2
Demonstrates three different ways to retrieve relational metadata:
- Via connection-level methods
- Via ObjectFinder methods
- Via JMI methods
|
Relational_3.java:
view source
view result |
Relational 3 - Direct execution of SQL statement
Demonstrates how to retrieve a result set by directly executing a
SQL statement, then shows how to display the result set as an HTML
table. |
Relational_4.java:
view source
view result |
Relational 4 - Simple relational query
Demonstrates how to retrieve a result set by creating a simple query,
then shows how to display the result set as an HTML table. |
Relational_5.java:
view source
view result |
Relational 5 - More complex relational query
Demonstrates how to retrieve a result set by creating a more complex
query with the following features:
- Field selections
- Joins
- Sorting
|
Helpers.java:
view source |
Helper methods
Provides static helper methods that facilitate connecting to data
sources and rendering result sets. |
Configuring your System
First, be sure you've consulted the SDK Installation
instructions, and then follow with the sections below to get up and running
with the examples.
Data Sources
You can view the example source and result on this page, but to actually
work with and run the examples, you need the following data sources:
Rendering to File
These examples implement a minimal HTTP servlet, which generates HTML
for easy viewing of results. By default, running the main
method without a parameter will write the HTML to the console. To write
it to an HTML file instead, specify a filename, with full path and .html
extension, as the parameter.
Connection Properties
Four properties files, one for each BI Java Connector, provide connection
properties to the connectors:
Create these files locally in the same folder as your example code, or
edit them to override the properties and name them Helpers.nnnn.local.properties
(where "nnnn" corresponds to the four-letter connector
name). The examples will first look for the local file, and if not found,
will take the original properties files.
For connection configuration information, refer to the howto.html
file that ships inside of each resource adapter archive. The connectors'
howto.html files are also included in this distribution
package for your reference, accessible from the Connectors
page.
For Additional Information
- These examples are referred to in the Developer's
Guide (
);
the Tutorial examples form the basis for the Getting Started chapter.
- Refer to the Connectors page for more
information about the BI Java Connectors.
|