Adapter for JDBC 10.3 | webMethods Adapter for JDBC Documentation | webMethods Adapter for JDBC Installation and User’s Documentation | Data Type Configuration | The Database-Specific Data Type Mapping Files | extTypeMapping | Configuring a new data type
 
Configuring a new data type
*To configure a new data type in Adapter for JDBC
1. Open the database-specific data type mapping configuration file from the location- Integration Server_directory\instances\instance_name\packages\WmJDBCAdapter\config directory.
For example, to configure the SDO_GEOMETRY data type in an Oracle database, open the OracleTypeMapping.xml file.
2. Add the jdbcType, typeClassName , and javaType attributes for the new data type in the extTypeMapping section of the configuration file.
For example,
<extTypeMapping>
....
...
<jdbcType name="SDO_GEOMETRY" code="2002"
typeClassName="com.test.OracleSDOGeometryType">
<javaType name="STRING"/>
<javaType name="STRUCT"/>
<javaType name="OBJECT"/>
</jdbcType>
</extTypeMapping>
3. In the columnTypeMapping section of the file, specify the new data type for the jdbcTypeName and nativeSqlType attributes in the columnType. This allows you to map the column in the database with the jdbcType attribute.
For example,
<columnType jdbcTypeName="SDO_GEOMETRY"
nativeSqlType="SDO_GEOMETRY" includeColumnSize="false"/>
4. Create a new custom java class. Use the following attributes in the table to create the custom java class:
Attribute
Usage Note
Class Name
You can specify any name for the attribute.
Base Class
The new custom java class must be derived from the base class which is com.wm.adapter.wmjdbc.config.JDBCType.
Location: Integration Server_directory\instances\instance_name\packages\WmJDBCAdapter\code\classes\com\wm\adapter\wmjdbc\config\JDBCType
Constructor
Override the constructor for the JDBCType which is:
public JDBCType (String name, int code, JAVAType javaType)
Methods
Override the two methods:
*Object getOutput(ResultSet results, int index)
*setInput(PreparedStatement statement, int index, Object value)
Example,
The template to create a new java class for SDO_GEOMETRY data type in an Oracle database is as follows:
import com.wm.adapter.wmjdbc.config.JDBCType;

public class OracleSDOGeometryType extends JDBCType {

public OracleSDOGeometryType(String name, int code, JAVAType javaType) {
super(name, code, javaType);
}

@Override
public Object getOutput(ResultSet results, int index) throws
SQLException,DataMappingException {

/* Enter your code */

}
@Override
protected void setInput(PreparedStatement statement, int index, Object value) throws
SQLException, DataMappingException, IOException {

/* Enter your code */

}
}
5. Create a jar file using the new custom java class
6. Copy the .jar files for the typeClassName attribute to the location: Integration Server_directory\instances\instances_name\pacakges\WmJDBCAdapter\code\jars directory.
7. Restart the Integration Server