>
> 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.
>
>
We use JNDI to set up our datasource. So in spring configuration, we have
<bean id="dataSource"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/jdbc/myapp" />
</bean>
Then in <tomcat_base>\conf\context.xml we have
<Context>
<Resource name="jdbc/myapp"
auth="Container"
type="javax.sql.DataSource"
username="<username>"
password="<password>"
driverClassName="oracle.jdbc.OracleDriver"
url="jdbc:oracle:thin:@localhost:1521:xe"
maxActive="20"
maxIdle="2"
minIdle="1"
initialSize="2"
/>
</Context>
This will provide the jndi data source to all apps in the tomcat instance.
If you wish/need to restrict that to a single war, place the above entry in
conf/Catalina/[host]/[appName].xml. Using this technique you should be able
to specify multiple datasources.
Chris