Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Create a configuration file (XML) for the external schema and define the data source for it.

    Note

    While defining the data source in the configuration file for the external schema, use the following naming convention - <external schema name>_DS, e.g. EXTDB_DS.

    For example, the following sample shows a sample configuration file (ExtDBConfig.xml) for the external schema:

    Code Block
    languagexml
    titleExtDBConfig.xml
    <?xml version="1.0" encoding="UTF-8" ?>
    
    <!DOCTYPE sqlMapConfig      
        PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN"      
        "http://ibatis.apache.org/dtd/sql-map-config-2.dtd">
        
    <sqlMapConfig>
    	<properties resource="databaseconfig.properties" />
    	<transactionManager type="EXTERNAL">
    		<property name="SetAutoCommitAllowed" value="false"/>
    		<dataSource type="JNDI">
    			<property name="DataSource" value="${EXTDB_DS}"/> <!-- EXTDB_DS is the data source for the external schema. -->
    		</dataSource>
    	</transactionManager>
    	
    	<sqlMap resource="com/intellectdesign/canvas/database/ibatis/${CT_FW_DATABASE_VENDOR}/maps/viewdefn/Default_Function_SqlMap.xml" />
    	<sqlMap resource="com/intellectdesign/canvas/database/ibatis/common/maps/viewdefn/Default_SqlMap.xml" />
    	<sqlMap resource="com/intellectdesign/modelhouse/database/ibatis/${CT_FW_DATABASE_VENDOR}/maps/Payments.xml" />
    		
    </sqlMapConfig>


  2. Update the databaseconfig.properties file to specify the configuration for the external schema. The data source name and the JNDI for the new data source should be configured in the databaseconfig file and the same data source name has to be used in the database configuration XML.

    The following code snippet shows a sample configuration:

    Code Block
    languagebash
    # Specify the external schema in CT_IBATIS_DATASOURCE_KEYS.
    CT_IBATIS_DATASOURCE_KEYS = CT_MODEL_HOUSE,EXTDB # EXTDB is a sample external data source key 
    
    # Specify the data source to be used for the external schema (as specified in the configuration XML file).
    EXTDB_DS = java:comp/env/jdbc/EXTDB
    
    # Specify the configuration file for the external schema in the following key format - <DATA_SOURCE_KEY>_<DSXML>:
    EXTDB_DSXML = com/intellectdesign/modelhouse/database/ibatis/config/ExtDBConfig.xml


...