jboss mysql datasource configuration

  1. Download the latest JDBC driver for MySQL from http://dev.mysql.com/downloads/connector/j/
  2. Create folders "mysql/main" in "<JBoss-AS-7-Home>/modules/com"
  3. Copy the above downloaded JAR file(mysql-connector-java-x.x.x-bin.jar) in "<JBoss-AS-7-Home>/modules/com/mysql/main"
  4. Create "module.xml" in "<JBoss-AS-7-Home>/modules/com/mysql/main" and paste the following code into it
    <?xml version="1.0" encoding="UTF-8"?>
    <module xmlns="urn:jboss:module:1.1" name="com.mysql">
            <resource-root path="mysql-connector-java-x.x.x-bin.jar"/> <!-- change the jar here -->
            <module name="javax.api"/>
            <module name="javax.transaction.api"/>
            <module name="javax.servlet.api" optional="true"/>
  5. Goto: /standalone/configuration/standalone.xml
    • add mysql datasource in the node:
      <datasource jta="true" jndi-name="java:/JSFDemoJNDI" pool-name="my_pool" enabled="true" use-java-context="true" use-ccm="true">
          <connection-property name="zeroDateTimeBehavior">
              <user-name>username</user-name> <!-- change username here -->
              <password>passowrd</password> <!-- change password here -->
    • add mysql driver in the node in node:
      <driver name="mysql" module="com.mysql"/>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s