These instructions will help you configure a JNDI DataSource for Apache Ode when running inside the ServiceMix JBI container.
1. Edit $SERVICEMIX/conf/jndi.xml
Declare a managed connection factory pointing to your database:
<bean id="odeManagedConnectionFactory" class="org.jencks.tranql.DataSourceMCF">
<property name="driverName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql:/>
<property name="user" value="username"/>
<property name="password" value="myPassword"/>
</bean>
And register the DataSource in the JNDI registry by adding an <entry> under the <util:map> element:
<util:map id="jndiEntries">
<!-- Ode DataSource -->
<entry key="java:comp/env/jdbc/ode">
<bean id="odeDataSource" class="org.jencks.factory.ConnectionFactoryFactoryBean">
<property name="managedConnectionFactory" ref="odeManagedConnectionFactory"/>
<property name="connectionManager" ref="connectionManager"/>
</bean>
</entry>
<!-- ... other entries follow... -->
</util:map>
2. Edit ode-jbi.properties
In ode-jbi.properties, set the following properties:
ode-jbi.db.mode=EXTERNAL
ode-jbi.db.ext.dataSource=java:comp/env/jdbc/ode
(Be sure to match the JNDI lookup name to the one defined in $SERVICEMIX/conf/jndi.xml)
3. Add jencks-2.0-all library
Copy jencks-2.0-all.jar
under $SERVICEMIX/lib
4. Restart ServiceMix
And you're done! Don't forget to redeploy your service assemblies since they need to be re-synchronized with Ode.
Extras
Connection Pool Parameters
If you want to manually configure the connection pool parameters, edit $SERVICEMIX/conf/tx.xml and update the "poolingSupport" object. For example,
<jencks:poolingSupport id="poolingSupport"
connectionMaxIdleMinutes="5"
connectionMaxWaitMilliseconds="10000"
poolMaxSize="100"
poolMinSize="20" />