2 Replies Latest reply on Feb 18, 2015 11:08 AM by John Ament

    Reconnecting after a MySQL failure

    John Ament Master

      Hi,

       

      I had a similar issue in different AS7 builds.

       

      In WildFly 8.1 it looks like if the database is shutdown, it doesn't get restored.  Are there any configuration requirements or changes that can go in that will allow it to reestablish the connection?  This is what my config looks like:

       

      <datasource jndi-name="java:jboss/datasources/MySqlDS" pool-name="MySqlDS" enabled="true">
        <connection-url>${jdbc.url}</connection-url>
        <driver>com.mysql</driver>
        <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
        <pool>
        <min-pool-size>10</min-pool-size>
        <max-pool-size>100</max-pool-size>
        <prefill>true</prefill>
        </pool>
        <security>
        <user-name>${jdbc.user}</user-name>
        <password>${jdbc.pass}</password>
        </security>
        <statement>
        <prepared-statement-cache-size>32</prepared-statement-cache-size>
        <share-prepared-statements>true</share-prepared-statements>
        </statement>
      </datasource>

        • 1. Re: Reconnecting after a MySQL failure
          Daniel Novo Newbie

          Try this

           

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

            <connection-url>${jdbc.url}</connection-url>

            <driver>com.mysql</driver>

            <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>

            <new-connection-sql>SELECT 1</new-connection-sql>

            <pool>

            <min-pool-size>10</min-pool-size>

            <max-pool-size>100</max-pool-size>

            <prefill>true</prefill>

            </pool>

            <security>

            <user-name>${jdbc.user}</user-name>

            <password>${jdbc.pass}</password>

            </security>

              <validation>

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

            </validation>

            <statement>

            <prepared-statement-cache-size>32</prepared-statement-cache-size>

            <share-prepared-statements>true</share-prepared-statements>

            </statement>

          </datasource>

          • 2. Re: Reconnecting after a MySQL failure
            John Ament Master

            Thanks, almost did it.  I added more to the validation section as well.

             

            <validation>
              <validate-on-match>true</validate-on-match>
              <background-validation>false</background-validation>
              <check-valid-connection-sql>SELECT 1</check-valid-connection-sql>
              <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker" />
              <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter" />
            </validation>