Besides JMS, CMP, and JPA, we still need to hook up the rest of JBoss services with the external database. There are two ways to do it. One is easy but inflexible. The other is flexible but requires more steps. Now, let us discuss those two approaches respectively.
The easy way is just to change the JNDI name for the external database to
DefaultDS. Most JBoss services are hard-wired to use the
DefaultDS by default. So, by changing the DataSource name, we do not need to change the configuration for each service individually.
To change the JNDI name, just open the
*-ds.xml file for your external database, and change the value of the
jndi-name property to
DefaultDS. For instance, in
mysql-ds.xml, you would change
DefaultDS and so on. You will need to remove the
<JBOSS_HOME>/server/<PROFILE>/deploy/hsqldb-ds.xml file after you are done to avoid duplicated
messaging/$DATABASE-persistence-service.xml file, you should also change the datasource name in the
depends tag for the
PersistenceManagers MBean to
DefaultDS. For instance, for
mysql-persistence-service.xml file, we change the