jboss

Connecting to MySQL Database for JBoss AS 7

Setting Up MySQL for JBoss AS 7

The following are the steps that you will need to follow to setup mysql datasource in JBoss AS 7.

  1. Download the MySQL jdbc zip file from here:

  2. Create a directory mysql inside /jboss-as-7.1.1.Final/modules/com

  3. Inside that create a directory structure like the following:

    /jboss-as-7.1.1.Final/modules/com/mysql/main

  4. Inside the main copy and paste the following jar from the mysql connector that was downloaded in the first step.

    mysql-connector-java-5.1.XX-bin.jar

  5. Create a module.xml in the same folder and add the following inside that:

  6. Inside the standalone.xml in the bin directory add the following:

    com.mysql.jdbc.Driver
  7. Now startup your jboss and open the admin console.

  8. Inside the admin console create/add a new datasource and enter the proper details. You can put any name you want.

Remember to add the jndi name in the details as:

 java:/mysql
  1. Then enable the connection.
  2. Now you can check for the connection and you should be all set, if you have followed the above steps properly.

You can watch this video, which demonstrates the above steps.


This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow