title: MySQL clustering & JBOSS
body: <p>I need to configure JBOSS for MySQL clustering with databases at two different machines (i.e different IPs).</p>
  
  <p>Active-active configuration of db is desired with - </p>
  
  <ol>
  <li><p>Both db to be updated simultaneously</p></li>
  <li><p>Loadbalancing</p></li>
  <li><p>Failover handling - to switch to the other db in case of failure of the 1st db</p></li>
  </ol>
  
  <p>How do I configure mysql-ds.xml file to achieve all these ? Will it alone solve my problem or any other configuration changes need to be done ?</p>
  
  <p>So far I have tried the following but without much success -</p>
  
  <p><b> code sample 1 - </b></p>
  
  <pre><code>&lt;local-tx-datasource&gt;
              &lt;jndi-name&gt;/abc&lt;/jndi-name&gt;
              &lt;connection-url&gt;jdbc:mysql:loadbalance://ip1:portno1,ip2:portno2/dbname?loadBalanceBlacklistTimeout=5000&lt;/connection-url&gt; 
              &lt;driver-class&gt;com.mysql.jdbc.Driver&lt;/driver-class&gt;
              &lt;user-name&gt;def&lt;/user-name&gt;
              &lt;password&gt;defpassword&lt;/password&gt;
              &lt;exception-sorter-class-name&gt;path to exception sorter class&lt;/exception-sorter-class-name&gt;
      &lt;/local-tx-datasource&gt; 
  </code></pre>
  
  <p><b> code sample 2 - </b></p>
  
  <pre><code>&lt;local-tx-datasource&gt;
          &lt;jndi-name&gt;/abc&lt;/jndi-name&gt;
          &lt;connection-url&gt;jdbc:mysql:loadbalance://ip1:portno1,ip2:portno2/dbname?loadBalanceBlacklistTimeout=5000&lt;/connection-url&gt; 
          &lt;url-delimiter&gt;|&lt;/url-delimiter&gt;
              &lt;autoReconnect&gt;true&lt;/autoReconnect&gt;
              &lt;failOverReadOnly&gt;false&lt;/failOverReadOnly&gt;
              &lt;maxReconnects&gt;0&lt;/maxReconnects&gt;
              &lt;initialTimeout&gt;15&lt;/initialTimeout&gt;
              &lt;idle-timeout-minutes&gt;0&lt;/idle-timeout-minutes&gt;
              &lt;connection-property name="readOnly"&gt;false&lt;/connection-property&gt;
              &lt;min-pool-size&gt;5&lt;/min-pool-size&gt;
              &lt;max-pool-size&gt;20&lt;/max-pool-size&gt;
  
          &lt;driver-class&gt;com.mysql.jdbc.Driver&lt;/driver-class&gt;
          &lt;user-name&gt;def&lt;/user-name&gt;
          &lt;password&gt;defpassword&lt;/password&gt;
          &lt;exception-sorter-class-name&gt;path to exception sorter class&lt;/exception-sorter-class-name&gt;
  &lt;/local-tx-datasource&gt; 
  </code></pre>
  
  <p>What more is required ?</p>
  
  <p>Thanks</p>