1 Reply Latest reply on Aug 14, 2014 3:02 PM by Frank Langelage

    How do I specify a datasource driver class in my standalone.xml file?

    D. Alvarado Newbie

      Hi,

       

       

      I’m using JBoss 7.1.3.  I’m troubleshooting an issue related to setting up a MySQL replication JDBC URL and I was curious, how do you specify what driver class your data source should use?  We use MySQL 5.5.37 and even though I set the driver class element to a bogus value, everything still loads fine (from $JBOSS_HOME/standalone/configuration/standalone.xml).  I would expect the below invalid driver class to cause an exception but it does not ...

       

       

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

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

                          <driver>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>username</user-name>

                              <password>password</password>

                          </security>

                          <statement>

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

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

                          </statement>

                      </datasource>

                      <drivers>

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

                              <xa-datasource-class>BogusDriver</xa-datasource-class>

                          </driver>

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

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

                          </driver>

                      </drivers>

                  </datasources>

       

       

      We have the MySql connector JAR loaded in $JBOSS_HOME/modules.  The library is mysql-connector-java-5.1.22-bin.jar, but I think there’s some other element in my standalone.xml that I need to configure to point to the driver I want.

       

       

      Thanks, -