Database Reference
In-Depth Information
Let us look at the code for these steps and then discuss each line. here is the code to
begin the connection to the Sample.Basic database on the mustang server:
// initialize the JAPI
IEssbase essbase = IEssbase.Home.create(IEssbase.JAPI_VERSION);
he IEssbase.Home object exists solely for initializing an instance of the Java API.
you must also tell the API which version of the API you are writing your code against,
although frankly, in over 10 years of writing code with the Java API, I have never used
anything other than the IEssbase.JAPI_VERSION constant to specify the version. The
IEssbase object that is returned provides the context from which you can sign on to
Essbase.
Note: Comments in Java are specified using two slash characters ( // ). I recommend
that you comment your code such that someone who is not a programmer can read the
comments and understand what the code is doing. Even if you do not comment exten-
sively, be sure to write comments when you choose a certain method or algorithm from
several alternatives, so that you can later remember why you decided on a particular
alternative.
// connect to the server
IEssOlapServer server = essbase.signOn("timt", "essbase", false,
null, "embedded", "mustang");
he IEssbase interface contains eight methods named signOn where each method
has different arguments and return different types of objects. In Java, when you have
the same method name with different arguments or return values, the different meth-
ods are called overloads . In this case, I chose an overload that takes six arguments and
returns an instance of on IEssOlapServer that has been connected to the server. The six
arguments of this overload are the username , password , passwordIsToken , userNameAs ,
providerUrl, and olapServerName . Three of the argument names are self-explanatory,
but the other three arguments are not. he passwordIsToken argument is used to indi-
cate that the password field contains a single-sign-on (SSo) token instead of a password,
while the userNameAs argument allows an administrator to impersonate another user.
While these two arguments may be quite useful in certain circumstances, the provi-
derUrl argument is always important, as it indicates the location of the APS server to
use for the connection or, alternately, that you want to use a direct, “embedded mode,”
connection to Essbase and bypass the need for an APS server. In the example above,
the signOn method will use an embedded connection to the “mustang” server for user
“timt” who uses the (very insecure) password “essbase.”
// get the cube
IEssCube cube = server.getApplication("sample").getCube("basic");
once you are connected to the server, you can access the applications and data-
bases for which you have permission. unlike the classic Essbase add-in or Smart view,
however, there is not a nice dialog that pops up for you to make a selection. rather,
you have to know the names of the application and database you want to access. The
IEssOlapServer contains a collection of applications, and you can return a specific appli-
cation by name using the getApplication method. Likewise, the IEssOlapApplication
Search WWH ::




Custom Search