title: JBoss: can not connect to MySQL database
body: <p>I am running <code>JBoss</code> as standalone version. I would like to connect to my local <code>mysql database</code></p>
  
  <p>I copied the mysql connector in modules folder</p>
  
  <pre><code>me@air~/Downloads/jboss/standalone/configuration - 10:56:18  $ ls ../../modules/org/mysql/main/
  mysql-connector-java-5.1.22-bin.jar
  </code></pre>
  
  <p>Next I changed the <code>standalone.xml</code> in <code>jboss/standalone/configuration</code> as</p>
  
  <pre><code>                &lt;drivers&gt;
                      &lt;driver name="com.mysql" module="org.mysql" /&gt;
                      &lt;driver name="h2" module="com.h2database.h2"&gt; &lt;!-- default provided--&gt;
                          &lt;xa-datasource-class&gt;org.h2.jdbcx.JdbcDataSource&lt;/xa-datasource-class&gt;
                      &lt;/driver&gt;
                  &lt;/drivers&gt;
  </code></pre>
  
  <p>Then I added the datasource as</p>
  
  <pre><code>              &lt;datasource jndi-name="java:/bb" pool-name="bb-pool" enabled="true" use-java-context="true" use-ccm="true"&gt;
                      &lt;connection-url&gt;jdbc:mysql://127.0.0.1:3306/mydb&lt;/connection-url&gt;
                      &lt;driver&gt;mysql&lt;/driver&gt;
                      &lt;pool&gt;
                          &lt;min-pool-size&gt;10&lt;/min-pool-size&gt;
                          &lt;max-pool-size&gt;100&lt;/max-pool-size&gt;
                          &lt;prefill&gt;true&lt;/prefill&gt;
                      &lt;/pool&gt;
                      &lt;security&gt;
                          &lt;user-name&gt;bb&lt;/user-name&gt;
                          &lt;password&gt;bb&lt;/password&gt;
                      &lt;/security&gt;
                      &lt;statement&gt;
                          &lt;prepared-statement-cache-size&gt;100&lt;/prepared-statement-cache-size&gt;
                          &lt;share-prepared-statements&gt;true&lt;/share-prepared-statements&gt;
                      &lt;/statement&gt;
                  &lt;/datasource&gt;
  </code></pre>
  
  <p>I am using <code>JBoss AS 7.1</code>.
  When I start the server on console, I see errors</p>
  
  <pre><code>10:54:47,458 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
  10:54:47,671 INFO  [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report
  JBAS014775:    New missing/unsatisfied dependencies:
        service jboss.jdbc-driver.mysql (missing) dependents: [service jboss.data-source.java:/bb] 
  
  10:54:47,676 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
  10:54:47,676 ERROR [org.jboss.as] (Controller Boot Thread) JBAS015875: JBoss AS 7.1.1.Final "Brontes" started (with errors) in 2000ms - Started 134 of 212 services (2 services failed or missing dependencies, 74 services are passive or on-demand)
  </code></pre>
  
  <p>and when I hit <code>Ctrl+C</code>, I see</p>
  
  <pre><code>^C10:54:54,998 INFO  [org.jboss.as.osgi] (MSC service thread 1-8) JBAS011942: Stopping OSGi Framework
  10:54:55,004 INFO  [org.jboss.as.logging] JBAS011503: Restored bootstrap log handlers
  10:54:55,007 INFO  [com.arjuna.ats.jbossatx] ARJUNA032018: Destroying TransactionManagerService
  10:54:55,008 INFO  [com.arjuna.ats.jbossatx] ARJUNA032014: Stopping transaction recovery manager
  10:54:55,010 INFO  [org.apache.catalina.core.StandardContext] Container org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/] has not been started
  10:54:55,039 INFO  [org.apache.coyote.http11.Http11Protocol] Pausing Coyote HTTP/1.1 on http--127.0.0.1-8080
  10:54:55,039 INFO  [org.apache.coyote.http11.Http11Protocol] Stopping Coyote HTTP/1.1 on http--127.0.0.1-8080
  10:54:55,043 INFO  [org.jboss.as.controller] JBAS014774: Service status report
  JBAS014776:    Newly corrected services:
        service jboss.jdbc-driver.mysql (new available)
  
  10:54:55,044 INFO  [org.jboss.as] JBAS015950: JBoss AS 7.1.1.Final "Brontes" stopped in 47ms
  </code></pre>
  
  <p>I am new to JBoss and don't know how to fix this issue or to understand what is that I am doing wrong here</p>