1 Reply Latest reply on Nov 19, 2018 6:37 AM by Burcu (Yapıcı) Kalkan

    wildfly 10.1 mysql replication second database is read-only exception

    Burcu (Yapıcı) Kalkan Newbie

      I started using Wildfly 10.1 and use mysql as a database. I have two databases, DB1 and DB2. Wildfly will connect to DB2 when D1 disconnected. I've done it so far. But when I connect to DB2, I get a "Connection is read-only" error. I looked at the topic here [https://stackoverflow.com/questions/9409111/database-fail-over-in-jboss-data-sources][1] but

       

          > <connection-property name = "readOnly"> false </ connection-property>

       

        not resolve. I'm looking for a solution to that. I want master/master not master/slave. In my mysql configuration in standalone.xml:

       

              <datasources>

                  <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">

                      <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>

                      <driver>h2</driver>

                      <security>

                          <user-name>sa</user-name>

                          <password>sa</password>

                      </security>

                  </datasource>

                  <datasource jta="true" jndi-name="java:jboss/datasources/RailbaseLabDS" pool-name="RailbaseLabDS" enabled="true" use-java-context="true" use-ccm="true">

                      <connection-url>jdbc:mysql://IP1:3306,IP2:3306/DBN?autoreconnect=true</connection-url>

                      <driver-class>com.mysql.jdbc.Driver</driver-class>

                      <driver>mysql</driver>

                      <url-delimiter>|</url-delimiter>

                      <security>

                          <user-name>DBN</user-name>

                          <password>DBN</password>

                      </security>

                      <validation>

      <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"/>

      <check-valid-connection-sql>select 1</check-valid-connection-sql>

      <background-validation>true</background-validation>

      <background-validation-millis>5000</background-validation-millis>

      </validation>

                  </datasource>

                  <drivers>

                      <driver name="h2" module="com.h2database.h2">

                          <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>

                      </driver>

                      <driver name="mysql" module="com.mysql">

                          <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>

                      </driver>

                  </drivers>

              </datasources>

       

       

       

       

        [1]: https://stackoverflow.com/questions/9409111/database-fail-over-in-jboss-data-sources