Monthly Archives: April 2013

TomEE/OpenEJB and failover of datasources


Defining a DataSource in TomEE is quite easy, the most common way to do so is to define a Resource block in tomee.xml:

<Resource id="jdbc/ds" type="DataSource">
   JdbcUrl = jdbc:mysql://datasourcehost:3306/tomee
   ...
</Resource>

When you have multiple hosts you often use datasourcehost (in the previous sample) as a service host (or IP) to delegate then to real hosts. But sometimes it is not possible or too complicated. For such needs TomEE now provides a basic failover feature.

The idea is to reuse dynamic datasource feature of tomee to handle it.

Continue reading

Advertisements