Using c3p0 database pool

From Resin 4.0 Wiki

Jump to: navigation, search


Using a c3p0 datasource in Resin, bound into JNDI

This configuration can go in resin.xml as a child of <cluster>, <host>, or <web-app>, or in resin-web.xml. Where you put it depends on how globally you want the pool to be shared between webapps.

You may need to add the c3p0 jar to /var/resin/lib, the main Resin shared lib directory, since the pool will be created as a shared resource upon startup.

In the top XML element, define the c3p0 namespace by adding:


Then create the pool:

 <c3p0:ComboPooledDataSource resin:Jndi="java:comp/env/jdbc/mysql">

You can then reference the pool by the JNDI name "java:comp/env/jdbc/mysql". For eample in JPA persistence.xml:

Personal tools