1 Reply Latest reply on Jun 4, 2012 4:46 PM by Horst Leitenmueller

    driver-class makes no difference

    jepper Newbie

      Hi

       

      I want to set up p6spy, but jboss is not using the pass thru driver it appears.

       

      My question is:      Is <driver-class> effectively ignored but it's presence required?

       

      Setup:

       

      jboss 6.1.0 final

      mysql 5.5

      Both running on the same windows XP machine.

       

      CLASSPATH: D:\opt\jboss\jboss-6.1.0.Final\server\all\conf;D:\opt\jboss\jboss-6.1.0.Final\bin\run.jar

      D:\opt\jboss\jboss-6.1.0.Final\server\all\conf\spy.properties

      D:\opt\jboss\jboss-6.1.0.Final\server\all\lib\p6spy.jar

      D:\opt\jboss\jboss-6.1.0.Final\server\all\deploy\mysql-ds.xml

       

      It seems I can enter any random string in the <driver-class> tag. It makes no difference. I start jboss with a database with no tables. New jboss tables are created as expected, despite driver-class not being meaningful. If I delete the tag however, jboss complains and cannot speak to the database.

       

      mysql-ds.xml

      <datasources>

        <local-tx-datasource>

          <jndi-name>DefaultDS</jndi-name>

          <connection-url>jdbc:mysql://localhost:3306/jbossdb</connection-url>

          <driver-class>randomblah</driver-class>

          <user-name>myuser</user-name>

          <password>#</password>

          <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>

          <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker</valid-connection-checker-class-name>

          <metadata>

             <type-mapping>mySQL</type-mapping>

          </metadata>

        </local-tx-datasource>

      </datasources>

       

      mysql> show tables;

      +-------------------+

      | Tables_in_jbossdb |

      +-------------------+

      | hilosequences     |

      | timers            |

        • 1. Re: driver-class makes no difference
          Horst Leitenmueller Newbie

          hi,

           

          i possible have a answer for your problem, because i have the same problem on a jboss 5.1.0.GA

           

          to use actual p6spy you have todo 2 things:

           

          1. add set in spy.properties   useprefix to true
          2. add in -ds.xml to the connection-url  the prefix "p6spy:"jdbc:mysql...  (without quotes)

           

          problem behind if you are interessted is the loading mechanism of

          LocalManagedConnectionFactory.getDriver(final String url)

           

          which is not checking the driver-class entered only if real loaded for the first time but afterwards only the url is checked !

           

          // Check if the driver is already loaded, if not then try to load it

           

                if (isDriverLoadedForURL(url))

                {

                   return driver;

                } // end of if ()

           

           

          i hope the answer helps,

           

          br horst