Is it possible to create a spring mvc app with multiple database? I am creating a school management web app for schools. For simplify the database management, I want to map a single database for each school, but the web app remains same only change is the configuration of database. I am using jobss as server for my server and JNDI datasource configuration in my web app. And the all apps are hosting on same live server. Is it possible to do that, what is the best way to do that?
spring data source configuration:
<!-- JNDI setup -->
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName">
<value>java:jboss/datasources/ResponseDS</value>
</property>
</bean>
jboss standalone.xml configuration:
<datasource jndi-name="java:jboss/datasources/ResponseDS" pool-name="ResponseDSPool">
<connection-url>jdbc:mysql://localhost:3306/response</connection-url>
<driver>com.mysql</driver>
<transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
<pool>
<min-pool-size>10</min-pool-size>
<max-pool-size>100</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<user-name>root</user-name>
<password>password</password>
</security>
<statement>
<prepared-statement-cache-size>32</prepared-statement-cache-size>
<share-prepared-statements>true</share-prepared-statements>
</statement>
</datasource>