3 Replies Latest reply on Jul 1, 2008 1:54 PM by Dan DeSmet

    Checking DB connectivity from JMX console

    Dan DeSmet Newbie

      Is there a way to check and see if you can get a valid database connection from the JMX console?

        • 1. Re: Checking DB connectivity from JMX console
          Dan DeSmet Newbie

          So, it seems I didn't overlook anything, and there's no existing solution for what I was trying to do. My solution was to develop a custom MBean packaged in a .sar and put it in the deploy directory. It has a function where for simply typing the JNDI name of the datasource, and returning either a success string or the exception if the connection failed.

          • 2. Re: Checking DB connectivity from JMX console
            jaikiran pai Master

             

            "Gap_Tooth" wrote:
            Is there a way to check and see if you can get a valid database connection from the JMX console?


            Maybe not be exactly what you are looking for, but there's a new-connection-sql attribute you can configure in the -ds.xml. See this for more details http://wiki.jboss.org/wiki/ConfigDataSources

            • 3. Re: Checking DB connectivity from JMX console
              Dan DeSmet Newbie

              As far as I understand from the documentation, the <new-connection-sql> attribute and the <valid-connection-checker> attribute merely check to see if the connection returned from the pool is valid or not. I wanted to be able to go into the JMX console and quickly check to see if my configuration for the DataSource was correct or not. The MBean I developed allowed me to do this pretty quickly, and only took about fifteen minutes to write.

              If anyone needs help implementing the same thing, I can post a skeleton implementation of the MBean interface and service implementation I made here.