Oracle™ Business Intelligence Beans Java API Reference
Release 10
g (9.0.4)
Part number B12159_01


oracle.dss.connection.client
Class Connection

java.lang.Object
  |
  +--oracle.dss.connection.client.Connection
All Implemented Interfaces:
ErrorHandlerCallback, Persistable, java.io.Serializable, StringXMLizable

public class Connection
extends java.lang.Object
implements java.io.Serializable, Persistable, ErrorHandlerCallback

The main class of the connection bean. The connection bean manages connections to data. Each type of connection must have a separate Connection instance. For example, if you connect to the repository and to an RDBMS where OLAP services metadata is stored, then you need two Connection instances, one Connection for the repository and one for the RDBMS. A BISession can have multiple connections.

See Also:
Serialized Form

Constructor Summary
Connection()
          Constructor.

 

Method Summary
 void addListener(ConnectionListener listener)
          Adds a ConnectionListener to this connection.
 int connect()
          Connects this connection to the server.
 int disconnect()
          Disconnects this connection from the server.
 java.lang.String executeCommand(java.lang.String command)
          Executes the OLAP DML command and returns the result of the command.
 int free()
          Frees all resources that were allocated by this connection.
 java.lang.String getBeanName()
          Retrieves the name of this connection.
 int getConnectionStatus()
          Retrieves the status of this connection.
 java.lang.String getDriverImpl(java.lang.String driverType)
          Retrieve the driver associated with the specified drivertype from the connection bean.
 java.lang.String getDriverType()
          Retrieves the type of driver that this connection uses.
 java.lang.String getHostName()
          Retrieves the host name for this connection.
 java.lang.String getJdbcDriverType()
          Retrieves the type of JDBC driver used to connect to the OLAP service.
 java.lang.String getJdbcUrl()
          Retrieves the JDBC URL for this connection.
 java.util.Locale getLocale()
          Retrieves the locale that this MetadataManager uses.
 java.lang.String getOLAPServiceName()
          Retrieves the name of the OLAP service.
 java.lang.String getPassword()
          Retrieves the password for this connection.
 int getPortNumber()
          Retrieves the port number for this connection.
 java.lang.String getServerType()
          Retrieves the type of service that this connection is for.
 java.lang.String getService()
          Retrieves the service name for this connection.
 BISession getSession()
          Retrieves the session to which this Connection belongs.
 java.lang.String getSID()
          Retrieves the Oracle SID for this connection.
 java.lang.String getUsername()
          Retrieves the user name for this connection.
 PropertyBag getVersionInfo()
           
 java.lang.String getXMLAsString()
          Retrieves the XML representation of this connection.
 boolean isAlive()
          Indicates whether the CORBA stub can still talk to Oracle OLAP through the ORB and has not timed out.
 boolean isConnected()
          Indicates whether this connection instance is connected to the server.
 boolean isConnectionFailed()
          Indicates whether a connection is successful or has failed.
 java.util.Hashtable listDriverImpl()
          List the drivers associated with the connection bean
 int reconnect(PropertyBag reconnectParams)
          Reconnects this Connection.
 void removeDriverImpl(java.lang.String driverType)
          De-register the driver from the connection bean.
 void removeListener(ConnectionListener listener)
          Removes a ConnectionListener from this connection.
 void setBeanName(java.lang.String name)
          Specifies the name of this connection.
 void setConnectionStatus(int status)
          Specifies the current status of this connection.
 void setDriverImpl(java.lang.String driverType, java.lang.String driverClassName)
          Set the driverType and register the driver implementation for the specified the driverType.
 void setDriverType(java.lang.String driverType)
          Specifies the type of driver that this connection uses.
 void setHostName(java.lang.String hostname)
          Specifies the host name for this connection.
 void setJdbcDriverType(java.lang.String driverType)
          Specifies the type of JDBC driver used to connect to the OLAP service.
 void setJdbcUrl(java.lang.String jdbcUrl)
          Specifies the JDBC URL for this connection.
 void setLocale(java.util.Locale locale)
          Specifies the locale that this Connection uses.
 void setOLAPServiceName(java.lang.String olapService)
          Specifies the name of the OLAP service.
 void setPassword(java.lang.String password)
          Specifies the password for this connection.
 void setPortNumber(int port)
          Specifies the port number for this connection.
 void setProperty(java.lang.String name, java.lang.Object object)
          Sets a property on this connection
 void setServerType(java.lang.String serverType)
          Specifies the type of service that this connection is for.
 void setService(java.lang.String service)
          Specifies the service name for this connection.
 void setSession(BISession session)
          Specifies the session to which this Connection belongs.
 void setSID(java.lang.String sid)
          Specifies the Oracle SID for this connection.
 void setUsername(java.lang.String username)
          Specifies the user name for this connection.
 boolean setXMLAsString(java.lang.String xml)
          Specifies the XML representation of this connection.
 boolean verifyVersion()
          This method validates the internal connection version.

 

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Methods inherited from interface oracle.dss.util.persistence.Persistable
getPersistableAttributes, getPersistableComponents, initialize, setPersistableAttributes, setPersistableComponents

 

Methods inherited from interface oracle.dss.util.ErrorHandlerCallback
addErrorHandler, removeErrorHandler

 

Constructor Detail

Connection

public Connection()
Constructor.
Method Detail

setSession

public void setSession(BISession session)
Specifies the session to which this Connection belongs.
Parameters:
session - The BISession to which this Connection object belongs.

getSession

public BISession getSession()
Retrieves the session to which this Connection belongs.
Returns:
the BISession to which this Connection object belongs.

isConnected

public boolean isConnected()
Indicates whether this connection instance is connected to the server.
Returns:
true if this connection is connected, false if it is not connected.

isConnectionFailed

public boolean isConnectionFailed()
Indicates whether a connection is successful or has failed. Call this method to see if an attempt was made to connect and if the attempt was successful.
Returns:
true if this connection failed while an attempt was made to connect, false if the connection attempt succeeded and the connection is in a connected state.

addListener

public void addListener(ConnectionListener listener)
Adds a ConnectionListener to this connection. A ConnectionListener listens for connection events.
Parameters:
listener - The listener to add.

removeListener

public void removeListener(ConnectionListener listener)
Removes a ConnectionListener from this connection.
Parameters:
listener - The listener to remove.

connect

public int connect()
            throws ConnectionException
Connects this connection to the server.
Returns:
A constant that represents connection status. Possible values are listed in the See Also section.
Throws:
ConnectionException - If the connection process fails
See Also:
CB.CONNECTED, CB.NOT_CONNECTED, MDU.FAILURE, MDU.NO_REMOTE

disconnect

public int disconnect()
               throws ConnectionException
Disconnects this connection from the server.
Returns:
A constant that represents connection status. Possible values are listed in the See Also section.
Throws:
ConnectionException - If the disconnection process fails
See Also:
CB.CONNECTED, CB.NOT_CONNECTED, MDU.FAILURE, MDU.NO_REMOTE

executeCommand

public java.lang.String executeCommand(java.lang.String command)
                                throws ConnectionException
Executes the OLAP DML command and returns the result of the command. It is only supported with the 9i2 and higher database.
Parameters:
command - The OLAP DML command to execute.
Returns:
A String that contains the execution log that results from the execution of the specified DML command. If the command was successful, then the log contains the return value of the command. If the command was unsuccessful, then the log contains the resulting error report.
Throws:
ConnectionException - If the execution failed.

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object object)
Sets a property on this connection
Parameters:
name - The name of the property
object - The value of the property

getBeanName

public java.lang.String getBeanName()
Retrieves the name of this connection.
Returns:
The name of this connection.

setBeanName

public void setBeanName(java.lang.String name)
Specifies the name of this connection.
Parameters:
name - The name of this connection.

getServerType

public java.lang.String getServerType()
Retrieves the type of service that this connection is for. This method returns "OlapServer".
Returns:
The type of service that this connection is for.

setServerType

public void setServerType(java.lang.String serverType)
Specifies the type of service that this connection is for.
Parameters:
serverType - "OlapServer" for a ROLAP (Relational OLAP) connection.

getDriverType

public java.lang.String getDriverType()
Retrieves the type of driver that this connection uses. Possible return values are:
Returns:
The type of driver that this connection uses.
See Also:
MDU.MDM, MDU.PERSISTENCE

setDriverType

public void setDriverType(java.lang.String driverType)
Specifies the type of driver that this connection uses.
Parameters:
driverType - A constant that indicates the type of driver for this connection. Valid constants are listed in the See Also section.
See Also:
MDU.MDM, MDU.PERSISTENCE

getConnectionStatus

public int getConnectionStatus()
Retrieves the status of this connection.
Returns:
A constant that represents the status of this connection. Possible values are listed in the See Also section.
See Also:
CB.CONNECTED, CB.NOT_CONNECTED, CB.CONNECTING

setConnectionStatus

public void setConnectionStatus(int status)
Specifies the current status of this connection.
Parameters:
status - A constant that represents the status of this connection. Valid values are listed in the See Also section.
See Also:
CB.CONNECTED, CB.NOT_CONNECTED, CB.CONNECTING

getUsername

public java.lang.String getUsername()
Retrieves the user name for this connection.
Returns:
The user name for this connection.

setUsername

public void setUsername(java.lang.String username)
Specifies the user name for this connection.

If you use single sign-on, you do not need to call this method. The connection retrieves the user name from the DAD.

Parameters:
username - The user name for this connection.

getPassword

public java.lang.String getPassword()
Retrieves the password for this connection.
Returns:
The password for this connection.

setPassword

public void setPassword(java.lang.String password)
Specifies the password for this connection.

If you use single sign-on, you do not need to call this method. The connection retrieves the password from the DAD.

Parameters:
password - The password for this connection.

getService

public java.lang.String getService()
Retrieves the service name for this connection.
Returns:
The service name for this connection.

setService

public void setService(java.lang.String service)
Specifies the service name for this connection.
Parameters:
service - The service name for this connection.

getHostName

public java.lang.String getHostName()
Retrieves the host name for this connection.
Returns:
The host name for this connection.

setHostName

public void setHostName(java.lang.String hostname)
Specifies the host name for this connection.
Parameters:
hostname - The host name for this connection.

getPortNumber

public int getPortNumber()
Retrieves the port number for this connection.
Returns:
The port number for this connection.

setPortNumber

public void setPortNumber(int port)
Specifies the port number for this connection.
Parameters:
port - The port number for this connection.

getSID

public java.lang.String getSID()
Retrieves the Oracle SID for this connection.
Returns:
The Oracle SID for this connection.

setSID

public void setSID(java.lang.String sid)
Specifies the Oracle SID for this connection.
Parameters:
sid - The Oracle SID for this connection.

getJdbcUrl

public java.lang.String getJdbcUrl()
Retrieves the JDBC URL for this connection.
Returns:
The JDBC URL for this connection.

setJdbcUrl

public void setJdbcUrl(java.lang.String jdbcUrl)
Specifies the JDBC URL for this connection. The URL is currently only used by an OLAP service connection The URL should use the following syntax.
 jdbc:oracle:[Protocol]:@[Host]:[Jdbc Port]:[Database Sid]
Parameters:
jdbcUrl - The JDBC URL for this connection.

getOLAPServiceName

public java.lang.String getOLAPServiceName()
Retrieves the name of the OLAP service.
Returns:
The name of the OLAP service.

setOLAPServiceName

public void setOLAPServiceName(java.lang.String olapService)
Specifies the name of the OLAP service.
Parameters:
olapService - The name of the OLAP service.

getJdbcDriverType

public java.lang.String getJdbcDriverType()
Retrieves the type of JDBC driver used to connect to the OLAP service.
Returns:
The type of JDBC driver used to connect to the OLAP service.

setJdbcDriverType

public void setJdbcDriverType(java.lang.String driverType)
Specifies the type of JDBC driver used to connect to the OLAP service. For an OLAP connection, the default is "thin". For a connection to the BI Beans Catalog, the default is "oci8".
Parameters:
driverType - The type of JDBC driver used to connect to the OLAP service. Valid values are "thin" and "oci8".

free

public int free()
         throws ConnectionException
Frees all resources that were allocated by this connection. This method disconnects this connection and releases all its resources.
Returns:
CB.SUCCESS.
Throws:
ConnectionException - If a problem occurs in releasing resources.
See Also:
MDU.SUCCESS

getXMLAsString

public java.lang.String getXMLAsString()
                                throws BIPersistenceException
Retrieves the XML representation of this connection. This method is called by the persistence service when you save the connection to the repository. Application developers should not need to call this method.
Specified by:
getXMLAsString in interface StringXMLizable
Returns:
The XML representation of this connection.
Throws:
BIPersistenceException - If a problem occurs in getting the XML.

setXMLAsString

public boolean setXMLAsString(java.lang.String xml)
                       throws BIPersistenceException
Specifies the XML representation of this connection. The persistence service calls this method when the connection is restored from the repository. Application developers should not need to call this method.
Specified by:
setXMLAsString in interface StringXMLizable
Parameters:
name - The XML representation of this connection.
Returns:
true the XML was successfully set, false if not.
Throws:
BIPersistenceException - If a problem occurs in setting the XML.

setLocale

public void setLocale(java.util.Locale locale)
Specifies the locale that this Connection uses.
Parameters:
locale - The Locale for this Connection.

getLocale

public java.util.Locale getLocale()
Retrieves the locale that this MetadataManager uses.
Returns:
The locale for this MetadataManager uses.

isAlive

public boolean isAlive()
Indicates whether the CORBA stub can still talk to Oracle OLAP through the ORB and has not timed out.
Returns:
true if the CORBA stub is viable. false if the CORBA stub is dead.

reconnect

public int reconnect(PropertyBag reconnectParams)
              throws ConnectionException
Reconnects this Connection.
Parameters:
reconnectParams - Properties for reconnecting. Valid constants for an OLAP connecton are listed in the See Also section.
Throws:
ConnectionException - If there is a problem during the reconnection.
See Also:
CB.USERNAME, CB.PASSWORD, CB.HOSTNAME, CB.PORT, CB.SID, CB.SERVER_TYPE, MDU.DRIVER_TYPE

verifyVersion

public boolean verifyVersion()
This method validates the internal connection version. This method verifies the OLAP connection against the version of the OLAP API. It verifies the connection to the BI Beans Catalog against the version of the Catalog schema and the Java version.
Returns:
true if the version is valid, false if it is not.

getVersionInfo

public PropertyBag getVersionInfo()

setDriverImpl

public void setDriverImpl(java.lang.String driverType,
                          java.lang.String driverClassName)
Set the driverType and register the driver implementation for the specified the driverType. This driver will be used to establish the connection
Parameters:
driverType - String associated with the ConnectionDriver.
driverImpl - String representing the fully qualified class name of the ConnectionDriver implementation. The connection bean will instantiate the class at connect time.

listDriverImpl

public java.util.Hashtable listDriverImpl()
List the drivers associated with the connection bean
Returns:
Hashtable containing properties where the driverType is the key and driverImpl class name is the value.

getDriverImpl

public java.lang.String getDriverImpl(java.lang.String driverType)
Retrieve the driver associated with the specified drivertype from the connection bean.
Parameters:
driverType - String associated with the ConnectionDriver.
Returns:
String representing the driver class name

removeDriverImpl

public void removeDriverImpl(java.lang.String driverType)
De-register the driver from the connection bean.
Parameters:
driverType - String associated with the ConnectionDriver that should be removed.

Oracle™ Business Intelligence Beans Java API Reference
Release 10
g (9.0.4)
Part number B12159_01


Copyright © 2003, Oracle. All Rights Reserved.