Weak 9iR2, maybe i don't know? Anyone can help me?

I install a new Oracle 9i DB(R2) on my pc.
I want write a java programe to try the given OLAP Api.
Mostly confused me is that com.sun.java.util.collections.* must be import in my java programe. It's is used in OLAP API,very strange! Sun has charged the namespace to java.util.*,Why Oracle still use this package? And anyone can tell me this?
This is not bad, I just recompiled the src in jdk1.3.1,change the namespace from java.util.* to com.sun.java.util.collection.*.
But really bad thing the programe is not worked!!! I copied the code from the user guide, Change some code(not a lot). Then run it, Exception throwed out!! and Oracle DB Can't be reconnect!! I must restart my pc!!
Who Can tell me how to start a programe using the 9i OLAP? Thanks!
I post my code, BUT DO IT CAREFUL! IT MAY LET YOU CANNT RECONNECT ORACLE!
I used the user name sh, after install oracle has done it.
=============================================================================
import com.sun.java.util.collections.Iterator;
import oracle.express.mdm.*;
import oracle.olapi.metadata.MetadataObject;
import oracle.olapi.data.source.Source;
import oracle.express.olapi.data.full.ExpressDataProvider;
import oracle.express.olapi.transaction.ExpressTransactionProvider;
import java.sql.*;
public class TestOLAP {
static final int TERSE = 0;
static final int VERBOSE = 1;
public TestOLAP(){}
public static void main(String[] args) throws Exception {
// Connect through JDBC to a database on Lab1
// and get a DataProvider (see Chapter 3)
String url = "jdbc:oracle:thin:@localhost:1521:cmcc";
String user = "sh";
String password = "sh";
DriverManager.registerDriver (new oracle.jdbc.OracleDriver());
oracle.jdbc.OracleConnection conn = (oracle.jdbc.OracleConnection)java.sql.DriverManager.getConnection(url, user, password);
ExpressTransactionProvider tp = new ExpressTransactionProvider();
ExpressDataProvider dp = new ExpressDataProvider(conn, tp);
dp.initialize();
//ExpressDataProvider dp = MyConnection.connectOnLab1();
//Sample Code for Discovering Metadata
//Discovering the Available Metadata 4-11
// Create an MdmMetadataProvider
MdmMetadataProvider mp = null;
mp = (MdmMetadataProvider) dp.getDefaultMetadataProvider();
// Get metadata info about the root MdmSchema and its subschemas
MdmSchema root = null;
try {
root = mp.getRootSchema();
System.out.println("***Root MdmSchema: " + root.getName());
MdmDimension measureDim = root.getMeasureDimension();
System.out.println("******Measure MdmDimension: " + measureDim.getName());
getSchemaInfo(root, TERSE);
} catch (Exception e) {
System.out.println("***Exception encountered : " + e.toString());
// Make a Source object out of the PRODUCTS_DIM MdmDimension
System.out.println("***Making a Source object for PRODUCTS_DIM");
MdmDimension mdmProductDim = null;
try {
List rootDims = root.getDimensions();
Iterator rootDimIter = rootDims.iterator();
while (mdmProductDim == null && rootDimIter.hasNext()) {
MdmDimension aDim = (MdmDimension) rootDimIter.next();
if (aDim.getName().equals("PRODUCTS_DIM"))
mdmProductDim = aDim;
Source product = mdmProductDim.getSource();
System.out.println("******Made the Source");
} catch (Exception e) {
System.out.println("******Exception encountered : " + e.toString());
// Close the connection
conn.close();
//Sample Code for Discovering Metadata
//4-12 Oracle9i OLAP Developers Guide to the OLAP API
// Method for getting info about an MdmSchema
public static void getSchemaInfo(MdmSchema schema, int outputStyle) {
System.out.println("***Schema: " + schema.getName());
// Get the MdmSchemas dimension info
MdmDimension oneDim = null;
try {
List dims = schema.getDimensions();
Iterator dimIter = dims.iterator();
System.out.println(" ");
System.out.println("********************************************");
System.out.println(" ");
while (dimIter.hasNext()) {
oneDim = (MdmDimension) dimIter.next();
getDimInfo(oneDim, outputStyle);
System.out.println(" ");
System.out.println("********************************************");
System.out.println(" ");
} catch (Exception e) {
System.out.println("******Exception encountered : " + e.toString());
// Get the MdmSchemas measure info
MdmMeasure oneMeasure = null;
try {
List measures = schema.getMeasures();
Iterator measIter = measures.iterator();
while (measIter.hasNext()) {
oneMeasure = (MdmMeasure) measIter.next();
getMeasureInfo(oneMeasure, outputStyle);
System.out.println(" ");
System.out.println(" ");
} catch (Exception e) {
System.out.println("******Exception encountered : " + e.toString());
// Get the MdmSchemas subschema info
MdmSchema oneSchema = null;
try {
List subSchemas = schema.getSubSchemas();
Iterator subSchemaIter = subSchemas.iterator();
Sample Code for Discovering Metadata
Discovering the Available Metadata 4-13
while (subSchemaIter.hasNext()) {
oneSchema = (MdmSchema) subSchemaIter.next();
getSchemaInfo(oneSchema, VERBOSE);
} catch (Exception e) {
System.out.println("***Exception encountered : " + e.toString());
// Method for getting info about an MdmDimension
public static void getDimInfo(MdmDimension dim, int outputStyle) {
System.out.println("******MdmDimension Name: " + dim.getName());
System.out.println("*********Description: " + dim.getDescription());
if (outputStyle == VERBOSE) {
// Get MdmDimensionMemberType for the MdmDimension
try {
MdmDimensionMemberType dimMemberType = dim.getMemberType();
if (dimMemberType instanceof MdmStandardMemberType)
System.out.println("*********Member Type: MdmStandardMemberType");
if (dimMemberType instanceof MdmTimeMemberType)
System.out.println("*********Member Type: MdmTimeMemberType");
if (dimMemberType instanceof MdmMeasureMemberType)
System.out.println("*********Member Type: MdmMeasureMemberType");
} catch (Exception e) {
System.out.println("***Exception encountered : " + e.toString());
// Get attributes of the MdmDimension
try {
List attributes = dim.getAttributes();
Iterator attrIter = attributes.iterator();
while (attrIter.hasNext())
System.out.println("*********Attribute: " +
((MdmAttribute) attrIter.next()).getName());
} catch (Exception e) {
System.out.println("***Exception encountered : " + e.toString());
Sample Code for Discovering Metadata
4-14 Oracle9i OLAP Developers Guide to the OLAP API
// Get concrete class and hierarchy type of the MdmDimension
String kindOfDim = null;
try {
if (dim instanceof MdmListDimension) {
kindOfDim = "ListDim";
System.out.println("*********" + dim.getName() +
" is an MdmListDimension");
else if (dim instanceof MdmHierarchy)
switch(((MdmHierarchy) dim).getHierarchyType()) {
case (MdmHierarchy.UNION_HIERARCHY):
kindOfDim = "UnionHier";
System.out.println("*********" + dim.getName() +
" is a union MdmHierarchy");
break;
case (MdmHierarchy.LEVEL_HIERARCHY):
kindOfDim = "LevelHier";
System.out.println("*********" + dim.getName() +
" is a level MdmHierarchy");
break;
case (MdmHierarchy.VALUE_HIERARCHY):
kindOfDim = "ValueHier";
System.out.println("*********" + dim.getName() +
" is a value MdmHierarchy");
break;
else {
kindOfDim = "Level";
System.out.println("*********" + dim.getName() + " is an MdmLevel");
} catch (Exception e) {
System.out.println("***Exception encountered : " + e.toString());
// For level MdmHierarchy, get parent, ancestors, and region attributes
if (kindOfDim.equals("LevelHier"))
System.out.println("*********Parent attribute: " +
((MdmHierarchicalDimension) dim).getParentRelation().getName());
System.out.println("*********Ancestors attribute: " +
((MdmHierarchicalDimension) dim).getAncestorsRelation().getName());
System.out.println("*********Region attribute: " +
((MdmUnionDimensionDefinition) dim.getDefinition())
.getRegionAttribute().getName());
Sample Code for Discovering Metadata
Discovering the Available Metadata 4-15
// Get the MdmDimensionDefinition for the MdmDimension
MdmDimensionDefinition dimDef = dim.getDefinition();
// For union or level MdmHierarchy, list the regions and default hierarchy
if ((kindOfDim.equals("UnionHier")) || (kindOfDim.equals("LevelHier")))
try {
System.out.println(" ");
System.out.println("*********The following are the regions of " +
dim.getName());
List regions = ((MdmUnionDimensionDefinition)dimDef).getRegions();
Iterator regIter = regions.iterator();
while (regIter.hasNext()) {
MdmDimension oneRegion = (MdmDimension) regIter.next();
System.out.println("************" + oneRegion.getName());
if (oneRegion.hasMdmTag(MdmMetadataProvider.DEFAULT_HIERARCHY_TAG))
System.out.println("***************(The " + oneRegion.getName() +
" region is the default MdmHierarchy)");
} catch (Exception e) {
System.out.println("***Exception encountered : " + e.toString());
// For union or level MdmHierarchy, get region info
if ((kindOfDim.equals("UnionHier")) || (kindOfDim.equals("LevelHier")))
try {
System.out.println(" ");
System.out.println("*********Information about the regions of " +
dim.getName() + ":");
List regions = ((MdmUnionDimensionDefinition)dimDef).getRegions();
Iterator regIter = regions.iterator();
while (regIter.hasNext()) {
MdmDimension oneRegion = (MdmDimension) regIter.next();
getDimInfo(oneRegion, VERBOSE);
} catch (Exception e) {
System.out.println("***Exception encountered : " + e.toString());
System.out.println(" ");
//Sample Code for Discovering Metadata
// Method for getting info about an MdmMeasure
public static void getMeasureInfo(MdmMeasure measure, int outputStyle) {
System.out.println("******Measure: " + measure.getName());
if (outputStyle == VERBOSE) {
// Get the dimensions of the MdmMeasure
try {
List mDims = measure.getDimensions();
Iterator mDimIter = mDims.iterator();
while (mDimIter.hasNext())
System.out.println("*********Dimension of the Measure: " +
((MdmDimension) mDimIter.next()).getName());
} catch (Exception e) {
System.out.println("******Exception encountered : " + e.toString());

The OLAP API is built using JDK 1.2.2. The OLAP API supports Java 1.1 (1.1.8) as well as Java 1.2 and higher. The collections package was new in Java 1.2, but Sun backported it to 1.1.8. However, the backport package is in the com.sun namespace rather than in java.util. As long as we support Java 1.1.8, we must continue to use the backported collections jar file and its namespace.
Most likely you have encountered the bug with the OLAP 9iR2 denormalized snowflake schema support which is found in SH. This bug has a verified fix already and will be released with our first cumulative OLAP patch called 9.2.0.1.0a beginning of September.

Similar Messages

Maybe you are looking for

  • Data Separator

    Hi gurus, I want to upload a flat file in BW 7.0. I am creating the datasource, the problem I have is that the data separator and the thousands separator is the same (.) in the file. I can’t upload the file correctly it keeps adding a new field think

  • Email closing unexpectedly and safari issue

    Hi I have been using a macbook pro retina version for a year. Recently, my email has been closing unexpectedly. I can't even open it for a few second. It shows me this message when it close: Process:         Mail [2503] Path:            /Applications

  • MainStage 1.0.1 available

    Here's to seeing Logic 8.0.1 shortly to solve the controller problems.

  • Elements window will not maximize, help please

    For some reason my photoshop elements window will not maximize.  The editor workspace will just fine, but not the organizer.  I am using elements 6 and Vista.  Anyone else seen this happen?  I can see it on my task pane and it previews the screen for

  • Need to Create a Dynamic Calendar Based on School Year Sharepoint O365

    I have a request from a school program department. They are in need of a calendar based on total number of days in a school year (180) excluding weekends/holidays. The calendar will need to provide the following information: 1. Upon a student enterin