1 2 Previous Next 19 Replies Latest reply on Apr 18, 2013 4:43 AM by golovnin Go to original post
      • 15. Re: Reconnect to MySQL after its restart
        als

        Jakiran, I am attaching a test case. A simple Timer EJB querying a Mysql database called "test" with single table called "test".

        DDL for table creation is

         

        "

        delimiter $$

         

         

        CREATE TABLE `test` (

          `idtest` int(11) NOT NULL,

          `param` varchar(45) DEFAULT NULL,

          PRIMARY KEY (`idtest`)

        ) ENGINE=InnoDB DEFAULT CHARSET=utf8$$

         

        "

        Please insert some data in table, one row is enough.

         

        XA-Datasource in standalone.xml is

         

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

                            <xa-datasource-property name="ServerName">

                                localhost

                            </xa-datasource-property>

                            <xa-datasource-property name="DatabaseName">

                                test

                            </xa-datasource-property>

                            <xa-datasource-property name="User">

                                root

                            </xa-datasource-property>

                            <xa-datasource-property name="Password">

                               pass

                            </xa-datasource-property>

                            <xa-datasource-property name="AutoReconnectForPools">

                                true

                            </xa-datasource-property>

                            <xa-datasource-property name="FailOverReadOnly">

                                false

                            </xa-datasource-property>

                            <xa-datasource-property name="MaxReconnects">

                                100

                            </xa-datasource-property>

                            <xa-datasource-property name="ReconnectAtTxEnd">

                                true

                            </xa-datasource-property>

                            <xa-datasource-property name="PinGlobalTxToPhysicalConnection">

                                true

                            </xa-datasource-property>

                            <driver>com.mysql</driver>

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

                            <validation>

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

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

                                <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"/>

                            </validation>

                        </xa-datasource>

         

        Now the steps to reproduce.

         

        1.Run the example and see the output, which show a first row from "test" table.

        2.Restart the MYSQL table

        3.See that Jboss is not reconnecting to Mysql and unable to query the db.

         

        In case you need an additional info, please tell.

        • 16. Re: Reconnect to MySQL after its restart
          jaikiran

          Thank you for adding these details. One of us will take a look.

          • 17. Re: Reconnect to MySQL after its restart
            als

            Hello Jaikiran.

             

            Did you have a chance to look on it already?

            We'r trying to find a workaround, but still not succesful.

            • 18. Re: Reconnect to MySQL after its restart
              als

              Hello Jaikiran.

               

              Ok, lets summarize  the situation.I gave you all of the data : logs, test case, code , configuration - all of that.

               

              During 2 weeks we together couldnt prove that this is a mess in my configuration.

               

              Therefore I insist that this is a critical bug in 7.1.1, violating the basic J2EE specification and this should reopened in the JIRA.

              I know very well that community projects are not supported by any SLA, but in such case I think that 2 weeks is more than enough to say that this is a bug.

               

              If you found that I am wrong and the mistake is on my side- please tell. I will be glad to supply any additional info

              • 19. Re: Reconnect to MySQL after its restart
                golovnin

                Hello Alexey,

                 

                add to the validation section of the datasource definition following line:

                 

                <validate-on-match>true</validate-on-match>

                 

                This should fix your problem.

                 

                You can also remove check-valid-connection-sql as MySQLValidConnectionChecker uses the ping()-method, which is more efficient than executing SQL-statement, from the MySQL-JDBC driver to test the connection.

                 

                Hope this helps.

                 

                Best regards,

                Andrej Golovnin

                1 2 Previous Next