You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

This articles shows you how to configure a mysql datasource in Geronimo. Geronimo is embedded with mysql resource adapters supporting both local and XA transactions, you need to install mysql JDBC drivers by yourself as instructed.

There are two ways to configure a mysql datasource:

Creating a datasource and deploying it as a standalone JEE connector module

  1. Refer to the attachment sample-mysql-xa-ds-plan-standalone.xml to create a standalone JEE connector deployment plan
  2. Install the mysql jdbc driver to geronimo repository via the adminitrative console, and ensure its Module ID is the same as the defined one in the sample plan. In this example, the Module ID of mysql JDBC driver is mysql/mysql-connector-java/5.1.7/jar.
  3. Use command line to deploy it. Here is the sample command for mysql xa datasource:
    <geronimo_home>/bin/deploy.sh -u system -p manager deploy 
    <GERONIMO_HOME>/repository/org/tranql/tranql-connector-mysql-xa/1.2/tranql-connector-mysql-xa-1.2.rar sample-mysql-xa-ds-plan-standalone.xml
    
    where <geronimo_home> is the installation directory of Geronimo.
  4. Then you will able to use the datasource via its jndi name java:comp/env/jdbc/mysqlxads.

Embedding a datasource definition in an application deployment plan

  1. Refer to the attachment sample-mysql-xa-ds-plan-embeded.xml to create an application deployment plan, replace web module and ejb module according to your application.
  2. Install the mysql jdbc driver to geronimo repository via the adminitrative console, and ensure its Module ID is the same as the defined one in the sample plan. In this example, the Module ID of mysql JDBC driver is mysql/mysql-connector-java/5.1.7/jar.
  3. Use command line or adminitrative console to deploy your application with the plan. For example, the command line as follows:
    <geronimo_home>/bin/deploy.sh -u system -p manager deploy yourapp.ear sample-mysql-xa-ds-plan-embeded.xml
    
    where <geronimo_home> is the installation directory of Geronimo.
  4. Then you will able to use the datasource via its jndi name java:comp/env/jdbc/mysqlxads

The transaction configuration element is something like:

<connectionmanager>
  <xa-transaction>
     <transaction-caching/>
  </xa-transaction>
  ...
</connectionmanager>

And for local transaction:

<connectionmanager>
   <local-transaction/>
   ...
</connectionmanager>
  • No labels