public interface OlapWrapper
OlapWrapper
duplicates the functionality of the
java.sql.Wrapper
interface (introduced in JDBC 4.0), making
this functionality available to olap4j clients running in a JDBC 3.0
environment. For code which will run only on JDBC 4.0 and later, Wrapper can
be used, and OlapWrapper can be ignored.
In JDBC 3.0 (JDK 1.5) and earlier, the OlapWrapper
interface
is used to convert a JDBC class to the corresponding olap4j class. For
instance, write
to create a JDBC 3.0 connection and convert it to an olap4j connection.import java.sql.Connection; import java.sql.DriverManager; import org.olap4j.OlapConnection; import org.olap4j.OlapWrapper; Connection connection = DriverManager.getConnection("jdbc: ..."); OlapWrapper wrapper = (OlapWrapper) connection; OlapConnection olapConnection = wrapper.unwrap(OlapConnection.class);
In JDBC 4.0 (JDK 1.6) and later, you don't need to use this class. All of
the key JDBC classes implement java.sql.Wrapper
interface, so
you can use its isWrapper
and unwrap
methods
without casting. For instance, write
to create a JDBC 4.0 connection and convert it to an olap4j connection.import java.sql.Connection; import java.sql.DriverManager; import org.olap4j.OlapConnection; Connection connection = DriverManager.getConnection("jdbc: ..."); OlapConnection olapConnection = connection.unwrap(OlapConnection.class);
Modifier and Type | Method and Description |
---|---|
boolean |
isWrapperFor(Class<?> iface) |
<T> T |
unwrap(Class<T> iface) |
<T> T unwrap(Class<T> iface) throws SQLException
SQLException
boolean isWrapperFor(Class<?> iface) throws SQLException
SQLException