Hello Tomcat users,

I need some help creating my context.xml file in a correct way.

My application is based on Spring and Hibernate. I need to configure more than one datasource
to access multiple databases at the same time.

This is my working Spring datasource.xml:

<bean id="parentDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" abstract="true">
<property name="driverClassName" value="org.sqlite.JDBC" />
<property name="username" value="sa" />
</bean>

<bean id="firstDataSource" parent="parentDataSource">
<property name="url" value="jdbc:sqlite:C:\firstDatabase.db" />
</bean>

<bean id="secondDataSource" parent="parentDataSource">
<property name="url" value="jdbc:sqlite:C:\secondDatabase.db" />
</bean>

<bean id="dataSource" class="com.ax.dashboard.datasource.AxRoutingDataSource">
<property name="targetDataSources">
<map key-type="java.lang.String">
<entry key="first" value-ref="firstDatasource" />
<entry key="second" value-ref="secondDataSource" />
</map>
</property>
<property name="defaultTargetDataSource" ref="firstDatasource" />
</bean>


Is it possible to create a corresponding context to configure the databases outside my war file?
I can't find any solution in the web.

Thanks a lot.

Regards,
Stephan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to