Class XmlaOlap4jDriver
- All Implemented Interfaces:
Driver
Since olap4j is a superset of JDBC, you register this driver as you would any JDBC driver:
Class.forName("org.olap4j.driver.xmla.XmlaOlap4jDriver");
Then create a connection using a URL with the prefix "jdbc:xmla:".
For example,
import java.sql.Connection;
import java.sql.DriverManager;
import org.olap4j.OlapConnection;
Connection connection =
DriverManager.getConnection(
"jdbc:xmla:");
OlapConnection olapConnection =
connection.unwrap(OlapConnection.class);
Note how we use the java.sql.Connection#unwrap(Class) method to down-cast
the JDBC connection object to the extension OlapConnection
object. This method is only available in JDBC 4.0 (JDK 1.6 onwards).
Connection properties
Unless otherwise stated, properties are optional. If a property occurs multiple times in the connect string, the first occurrence is used.
It is also possible to pass properties to the server end-point using
JDBC connection properties as part of the XMLA driver connection properties.
If the JDBC URL contains properties that are not enumerated in
XmlaOlap4jDriver.Property, they will be included as part of the SOAP PropertyList
element.
| Property | Description |
|---|---|
| Server | URL of HTTP server. Required. |
| Catalog | Catalog name to use. By default, the first one returned by the XMLA server will be used. |
| Schema | Schema name to use. By default, the first one returned by the XMLA server will be used. |
| Database | Name of the XMLA database. By default, the first one returned by the XMLA server will be used. |
| Cache | Class name of the SOAP cache to use.
Must implement interface
By default, no SOAP query cache will be used. |
| Cache.* | Properties to transfer to the selected cache
implementation. See
XmlaOlap4jCache
or your selected implementation for properties
details.
|
| TestProxyCookie | String that uniquely identifies a proxy
object in PROXY_MAP via which to
send XMLA requests for testing
purposes.
|
| Role | Comma separated list of role names used for
this connection (Optional). Available role names can be retrieved via OlapConnection.getAvailableRoleNames()
|
| User | User name to use when establishing a connection to the server. The credentials are passed using the HTTP Basic authentication protocol, but are also sent as part of the SOAP Security headers. |
| Password | Password to use when establishing a connection to the server. The credentials are passed using the HTTP Basic authentication protocol, but are also sent as part of the SOAP Security headers. |
- Since:
- May 22, 2007
- Author:
- jhyde, Luc Boudreau
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumProperties supported by this driver. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanacceptsURL(String url) connect(String url, Properties info) protected XmlaOlap4jProxycreateProxy(Map<String, String> map) Creates a Proxy with which to talk to send XML web-service calls.static Future<byte[]> getFuture(XmlaOlap4jProxy proxy, XmlaOlap4jServerInfos serverInfos, String request) Returns a future object representing an asynchronous submission of an XMLA request to a URL.intintgetPropertyInfo(String url, Properties info) Returns the driver version.booleanstatic StringGenerates and returns a unique string.
-
Field Details
-
PROXY_MAP
For testing. Map from a cookie value (which is uniquely generated for each test) to a proxy object. Uses a weak hash map so that, if the code that created the proxy 'forgets' the cookie value, then the proxy can be garbage-collected.
-
-
Constructor Details
-
XmlaOlap4jDriver
public XmlaOlap4jDriver()Creates an XmlaOlap4jDriver.
-
-
Method Details
-
connect
- Specified by:
connectin interfaceDriver- Throws:
SQLException
-
acceptsURL
- Specified by:
acceptsURLin interfaceDriver- Throws:
SQLException
-
getPropertyInfo
- Specified by:
getPropertyInfoin interfaceDriver- Throws:
SQLException
-
getVersion
Returns the driver version. Not in the JDBC API.- Returns:
- Driver version
-
getMajorVersion
public int getMajorVersion()- Specified by:
getMajorVersionin interfaceDriver
-
getMinorVersion
public int getMinorVersion()- Specified by:
getMinorVersionin interfaceDriver
-
jdbcCompliant
public boolean jdbcCompliant()- Specified by:
jdbcCompliantin interfaceDriver
-
getParentLogger
- Specified by:
getParentLoggerin interfaceDriver
-
createProxy
Creates a Proxy with which to talk to send XML web-service calls. The usual implementation of Proxy uses HTTP; there is another implementation, for testing, which talks to mondrian's XMLA service in-process.- Parameters:
map- Connection properties- Returns:
- A Proxy with which to submit XML requests
-
getFuture
public static Future<byte[]> getFuture(XmlaOlap4jProxy proxy, XmlaOlap4jServerInfos serverInfos, String request) Returns a future object representing an asynchronous submission of an XMLA request to a URL.- Parameters:
proxy- Proxy via which to send the requestserverInfos- Server infos.request- Request- Returns:
- Future object from which the byte array containing the result of the XMLA call can be obtained
-
nextCookie
Generates and returns a unique string.- Returns:
- unique string
-