12.2.1 List of the methods in the Wrapper interface
- Organization of this subsection
(1) Main functions of the Wrapper interface
The Wrapper interface provides a standardized approach for calling methods that are not JDBC-compliant.
(2) Methods in the Wrapper interface that are supported by HADB
The following table lists and describes the methods in the Wrapper interface that are supported by HADB.
|
No. |
Method of the Wrapper interface |
Function |
|---|---|---|
|
1 |
Returns a value indicating whether a specified class's object can be returned by the unwrap method. |
|
|
2 |
Returns a specified class's object. |
(3) Classes that can be specified
The following table lists the classes that can be specified in unwrap for an interface that has inherited Wrapper.
|
No. |
Interface |
Class that can be specified in unwrap |
|---|---|---|
|
1 |
java.sql.Connection |
AdbConnection |
|
2 |
java.sql.DatabaseMetaData |
AdbDatabaseMetaData |
|
3 |
javax.sql.DataSource |
AdbDataSource |
|
4 |
java.sql.ResultSet |
AdbResultSet |
|
5 |
java.sql.ResultSetMetaData |
AdbResultSetMetaData |
|
6 |
java.sql.Statement |
AdbStatement |
|
7 |
java.sql.PreparedStatement |
AdbPreparedStatement |
|
8 |
java.sql.ParameterMetaData |
AdbParameterMetaData |
(4) Example coding
The following shows an example of Wrapper interface coding:
Connection con = DriverManager.getConnection(url,info);
Class<?> clazz = Class.forName("com.hitachi.hadb.jdbc.AdbConnection");
if(con.isWrapperFor(clazz)){
AdbConnection acon = (AdbConnection)con.unwrap(clazz);
acon.xxxx();
}