There will be scenarios where you need to fetch data from external data sources (schemas) other than the implementation databaseschema. In such scenarios, perform the following:
Create a configuration file (XML) for the external database schema and define the data source for it.
Note While defining the data source in the configuration file for the external databaseschema, use the following naming convention - <external db schema name>_DS, e.g. EXTDB_DS.
For example, the following sample shows a sample configuration file (ExtDBConfig.xml) for the external databaseschema:
Code Block language xml title ExtDBConfig.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 databaseschema. --> </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>
Info In the individual SQL Map files (XML), the select ID must be in the format VIEW_MGR_FRMWK_MNT_SELECT_<SQL_ID>, where the SQL_ID must be specified as the value for the SQL Param Map ID in the App Designer configuration.
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. ReferĀ Configuration Descriptor: Database for more information on databaseconfig.properties.
The following code snippet shows a sample configuration:
Code Block language bash # Specify the external databaseschema in CT_IBATIS_DATASOURCE_KEYS. CT_IBATIS_DATASOURCE_KEYS = CT_MODEL_HOUSE,EXTDB #EXTDB# EXTDB is a sample theexternal keydata forsource externalkey database # Specify the data source to be used for the external databaseschema (as specified in the configuration XML file). EXTDB_DS = java:comp/env/jdbc/EXTDB # Specify the configuration file for the external database. schema in the following key format - <DATA_SOURCE_KEY>_<DSXML>: EXTDB_DSXML = com/intellectdesign/modelhouse/database/ibatis/config/ExtDBConfig.xml
...