These instructions will help you configure a JNDI DataSource for Apache ODE when running inside the ServiceMix JBI container.
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://hostname/databaseName"/> <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>
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)
Copy jencks-2.0-all.jar under $SERVICEMIX/lib
And you're done! Don't forget to redeploy your service assemblies since they need to be re-synchronized with ODE.
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" />