Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In Geronimo the JDBC resources are implemented using J2EE connectors. Therefore, you need to write a Geronimo specific deployment plan for deploying a JDBC datasource. Additionally, while doing the deployment you need to provide the deployer with the tranql-connector-ra-1.13.rar file. This RAR file contains the connection pool management logic for Geronimo.

...

Code Block
xml
xml
borderStylesolid
titleData source deployment plan
<?xml version="1.0" encoding="UTF-8"?>



<connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2">

           configId="geronimo/jdbcdatasource/1.0/car"
           parentId="geronimo/j2ee-server/1.0/car">
<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>3.1.14-bin</version>
</dependency>
<resourceadapter>
  <outbound-resourceadapter>
    <connection-definition>
      <connectionfactory-interface>
        javax.sql.DataSource<dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1">
    <dep:moduleId>
	  <dep:groupId>user</dep:groupId>
	  <dep:artifactId>jdbcdatasource</dep:artifactId>
	  <dep:version>2.0</dep:version>
	  <dep:type>car</dep:type>
	</dep:moduleId>
	<dep:dependencies>
	  <dep:dependency>
	    <dep:groupId>mysql</dep:groupId>
		<dep:artifactId>mysql-connector-java</dep:artifactId>
		<dep:version>3.1.14-bin</dep:version>
		<dep:type>jar</dep:type>
	  </dep:dependency>
	</dep:dependencies>
  </dep:environment>

<resourceadapter>

  <outbound-resourceadapter>

    <connection-definition>

      </connectionfactory<connectionfactory-interface>

      <connectiondefinition-instance>
    javax.sql.DataSource

      </connectionfactory-interface>

      <connectiondefinition-instance>

        <name>TradeDS</name>

        <config-property-setting name="UserName">

          root

        </config-property-setting>

        <config-property-setting name="Password">

          password

        </config-property-setting>

        <config-property-setting name="Driver">

          com.mysql.jdbc.Driver

        </config-property-setting>

        <config-property-setting name="ConnectionURL">

          jdbc:mysql://localhost:3306/tradedb

        </config-property-setting>

        <config-property-setting name="CommitBeforeAutocommit">

           false

        </config-property-setting>

        <config-property-setting name="ExceptionSorterClass">

           org.tranql.connector.NoExceptionsAreFatalSorter

        </config-property-setting>



        <connectionmanager>

          <local-transaction/>

          <single-pool>

             <max-size>10</max-size>

             <min-size>0</min-size>

             <blocking-timeout-milliseconds>

                5000

              </blocking-timeout-milliseconds>

              <idle-timeout-minutes>

                30

              </idle-timeout-minutes>

              <match-one/>

          </single-pool>

        </connectionmanager>

      </connectiondefinition-instance>

    </connection-definition>

  </outbound-resourceadapter>

</resourceadapter>

</connector>

The listing above shows the plan for deploying a J2EE connector which will provide JDBC access to the database. The root element is the <connector> element. This element has the following four attributes:

...

./deployer.cmd --user system --password manager deploy <brokerage_home>\plan\mysql-geronimo-plan.xml <geronimo_home>\repository\org\tranql\rars\tranql-connector-ra\1.1.rar3tranql-connector-ra-1.3.rar

where brokerage_home is the path of the brokerage directory.This will deploy the data source.
Now you are ready to proceed with the migration.

...

Code Block
xml
xml
borderStylesolid
titlegeronimo-web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1" xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.1">
         <dep:environment xmlns:namingdep="http://geronimo.apache.org/xml/ns/naming"
         configId="geronimo/BrokerageApp/1.0/car" parentId="geronimo/jdbcdatasource/1.0/car">deployment-1.1">
	    <dep:moduleId>
		    <dep:groupId>BrokerageApp</dep:groupId>
			<dep:artifactId>MySqlDS</dep:artifactId>
			<dep:version>2.0</dep:version>
			<dep:type>car</dep:type>
		</dep:moduleId>

		<dep:dependencies>
		    <dep:dependency>
		        <dep:groupId>user</dep:groupId>
			    <dep:artifactId>jdbcdatasource</dep:artifactId>
			    <dep:version>2.0</dep:version>
			    <dep:type>car</dep:type>
			</dep:dependency>
		</dep:dependencies>

	</dep:environment>
<context-root>/brokerage</context-root>
<naming:resource
<resource-ref>

	<naming:ref<ref-name>jdbc/TradeDB</naming:ref-name>

     <naming:resource<resource-link>TradeDS</naming:resource-link>

</naming:resource-ref>

</web-app>

As shown in the example, the parent for this configuration is the MySQL J2EE connector. The naming:resource-ref element maps the TradeDS data source to the name jdbc/TradeDB. The context-root element gives the context-root of the application.

...