Migrate JBoss Datasources howto

This tutorial shows how you can automatically convert your Datasources from earlier JBoss AS versions (4-5-6) to JBoss AS 7 modular configuration using IronJacamar migration tool.

As most of you probably know, in previous versions of the application server, datasources and resource adapters were configured and deployed using a file with a suffix of *-ds.xml.

The IronJacamar 1.1.0 distribution contains a migration tool that can be used to convert these configuration files into the format expected by JBoss AS 7. The tool parses the source configuration file from the previous release, then creates and writes the XML configuration to an output file in the new format. The resulting XML can then be copied and pasted under the correct subsystem of JBoss AS 7 configuration file.

Download the IronJacamar 1.1 distribution from http://www.jboss.org/ironjacamar

Example: mysql-ds.xml (JBoss 4/5/6 Datasource for MySQL database)

<?xml version="1.0" encoding="UTF-8"?>


Now move to the doc\as folder of your ironjacamar-1.1.0 distribution and issue the following command:

C:\ironjacamar-1.1.0.Alpha7\doc\as>converter.bat -ds mysql-ds.xml mysql-as7.xml

As you can see the converter batch file (converter.sh for Unix OS) accepts as parameter -ds to choose between resource adapter and datasource and then the INPUT xml file and the OUTPUT file.

Here’s the generated mysql-as7.xml file:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  <datasource enabled="true" jndi-name="java:jboss/datasources/MySqlDS" jta="true" pool-name="MySqlDS" use-ccm="true" use-java-context="true">
      <exception-sorter class-name="org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter"/>

As you can see the file has been enriched with some defaults for <pool> and <validation>, <timeout> and <statement> so that you further configure your Datasource in AS 7. One more important note is that this tool automatically converts the JNDI name binding to meet AS 7 standards (java:jboss/datasources/MySqlDS).