title: Using MySQL replication (Master/Slave) with MyBatis
body: <p>I am just wondering how I can use a Master/Slave MySQL replication database with MyBatis. JDBC offers a <code>com.mysql.jdbc.ReplicationDriver</code> (see <a href="http://dev.mysql.com/doc/refman/5.1/en/connector-j-reference-replication-connection.html" rel="nofollow">here</a>), but I couldn't find out where I can use similar things including all the nice properties I can configure (<em>roundRobinLoadBalance</em>, <em>autoReconnect</em>,...) in MyBatis.</p>
  
  <p>Currently I have configured my none-replicated database in MyBatis like this:</p>
  
  <pre><code>&lt;environments default="development"&gt;
      &lt;environment id="development"&gt;
          &lt;transactionManager type="JDBC" /&gt;
          &lt;dataSource type="POOLED"&gt;
              &lt;property name="driver" value="com.mysql.jdbc.Driver" /&gt;
              &lt;property name="url"
                  value="jdbc:mysql://localhost:3306/database" /&gt;
              &lt;property name="username" value="root" /&gt;
              &lt;property name="password" value="" /&gt;
          &lt;/dataSource&gt;
      &lt;/environment&gt;
      &lt;environment id="production"&gt;
          &lt;transactionManager type="JDBC" /&gt;
          &lt;dataSource type="POOLED"&gt;
              &lt;property name="driver" value="com.mysql.jdbc.Driver" /&gt;
              &lt;property name="url"
                  value="jdbc:mysql://xxx:3306/database" /&gt;
              &lt;property name="username" value="production" /&gt;
              &lt;property name="password" value="" /&gt;
          &lt;/dataSource&gt;
      &lt;/environment&gt;
  &lt;/environments&gt;
  </code></pre>
  
  <p>Has anyone a a hint for me?</p>
  
  <p>Thanks for your help.</p>
  
  <p>Daniel</p>