I have a JEE 6 application deployed on JBoss 7.1 that currently connects to a standalone MySQL instance. It connects to a localhost MySQL using a standard datasource.xml (deployed on app server) and persistence (deployed in application .war), example below.
I wish to configure my application now to talk to an Amazon RDS MySql instance running in master-slave mode. Recommended configuration is to write only to the master and read only from the slaves. I presume this is achieved by datasource.xml edits but how exactly should I achieve this? Is there a sample -ds file available etc?
<?xml version="1.0" encoding="UTF-8"?>
<!-- to be copied to the deployments folder before the war is deployed but
after the mysql connector jar is copied to the deployments folder -->
Perhaps I define multiple datasources in one xml file, slave datasources are defined as readOnly and one master datasource is configured as a standard connection? If so does the container then handle sending writes and reads to the appropriate datasource?