As we know jboss uses HSQLDB for the jms persistence to modify this to persist the JMS messages to user Database like mysql, oracle, etc. Following changes as to be made in jboss 4.2.3. We assume the Postgres Database for this purpose.
1. Delete the hsqldb-ds.xml from JBOSS_HOME/server/[instance]/deploy folder.
2. Copy the respective database related ds file from JBOSS_HOME/docs/examples/jca/*-ds.xml file to deploy folder of your [instance].
3. Change the jndi-name in *-ds.xml file to “DefaultDS“.
4. Delete hsqldb-jdbc2-service.xml file from JBOSS_HOME/server/[instance]/jms folder.
5. Copy the respective database persitence manager service xml file *-jdbc2-service.xml from JBOSS_HOME/docs/examples/jms to JBOSS_HOME/server/[instance]/deploy/jms folder.
6. Change the jndi name in the *-jdbc2-service.xml to “DefaultDS“, jboss.jca:service=DataSourceBinding,name=DefaultDS
7. Rename the hsqldb-jdbc-state-service.xml to respective database name *-jdbc-state-service.xml, its optional you can keep the file as it is.
8. Copy the respective database connector jar file to /JBOSS_HOME/server/[instance]/lib folder.
Now the configuration is modified for the jms persistence to user database and data will persist to jms_message table only when the huge number of jms are generated and its a temporary storage once the jms message is consumed it will deleted automatically from the jms_message table.