We require an application in spring MVC which can interact with multiple databases at a time. In my application-context.xml, I have configured both of the data-sources with different id. Here is my application context file:
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="dataSource" />
</bean>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="${db.jndiName}"/>
</bean>
<bean id="jdbcTemplateSec" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="dataSourceSec" />
</bean>
<bean id="dataSourceSec" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="${db.jndiNameSec}"/>
</bean>
But through this I am unable to join multiple tables of different schemas. As each jdbcTemplate has specific datasource which restricts it to access another datasource. So please suggest some solution.
Thanks in advance...