Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

Anchortoptop

This article shows you how to configure a DB2 datasource in Apache Geronimo v1.0. Normally you would just use 2. Since the release of Geronimo v1.1 you can now select multiple drivers from the creation pool wizard on the Geronimo Administration Console and the creation pool wizard for this task but that method allows you to specify only ONE driver jar file. In the case of DB2 you would have multiple files, one for the driver and two additional files for the license.

This article focuses on those tasks for manually adding the additional jar files to the datasource configuration.

...

.

In this scenario we are creating a connection pool for a DB2 database, in order to connect to that database we will need to define at least two driver jar files. That is the JDBC driver itself and the respective license files. Depending on your implementation you will need different license files.

In this article we provide two alternatives to deploy the connection pool, the first approach we tackle is using the Geronimo Administration Console, then we explain the process for using the command line option instead.

Add DB2 drivers to the repository

To add the DB2 drivers and license to the Geronimo repository you will need to place those files in a particular directory structure. You will normally have two or three files to add to the repository, these files are:

...

These files are available in the <sqllib_home>\java directory. For additional information on the DB2 JDBC drivers and licenses visit the DB2 Information Center available at the following URL:

http://publib.boulder.ibm.com/infocenter/db2luw/v8/topic/com.ibm.db2.udb.doc/ad/t0010264.htmImage Removed

In order to use these files in Geronimo you will need to rename (copy and rename) as described in the following table.

...

You will need to create the following directory structures under the <geronimo_home>\repository directory and copy the appropriate files to the respectives respective directories.

  • com/ibm/db2/db2jcc/8.1.8
    and copy the db2jcc-8.1.8.jar into that directory.
  • com/ibm/db2/db2jcc_license_cisuz/8.1.8
    and copy the db2jcc_license_cisuz-8.1.8.jar into that directory.
  • com/ibm/db2/db2jcc_license_cu/8.1.8
    and copy the db2jcc_license_cisuz-8.1.8.jar into that directory.

Using the Geronimo

...

Administration Console

In order to use the console Apache Geronimo must be running. Access the Geronimo Administration Console by pointing your browser to the following URL:

http://localhost:8080/consoleImage Removed

  • Enter the system as the user and manager as the password and click Login.
  • Click on Common Libs to access the Repository viewer portlet.
  • Click on Browse and select the first file to install. In this case we will first install db2jcc-8.1.8.jar.
  • A set of values will be proposed by default, set the Group: to com.ibm.db2, leave the rest by default and click Install.
  • Repeate Repeat the previous two steps for db2jcc_license_cisuz-8.1.8.jar and db2jcc_license_cisuz-8.1.8.jar

With the drivers and license files installed you can now create a new database connection pool.

Create a

...

database conneciton pool using the wizard from the Geronimo Administration Console

From the Geronimo Administration Console select Database Pools and create a new pool by clicking on Using the Geronimo database pool wizard.

...

Leave the options on Step 3 by default, you should see the message Driver Status: Loaded Successfully.

Click on Skip Test and Show Plan.

Image Removed

Copy the content of the Deployment Plan: and past it as a new db2-plan.xml file. You can save this file in a directory of your convenience, for simplicity (although not recommended) we saved this file to the <geronimo_home>\bin directory.

The deployment plan generated by the wizard is shown in the following example.

...


<?xml version="1.0" encoding="UTF-8"?>
<connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.1">
    <dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1">
        <dep:moduleId>
            <dep:groupId>console.dbpool</dep:groupId>
            <dep:artifactId>DB2_ds</dep:artifactId>
            <dep:version>1.0</dep:version>
            <dep:type>rar</dep:type>
        </dep:moduleId>
        <dep:dependencies>
            <dep:dependency>
                <dep:groupId>com.ibm</dep:groupId>
                <dep:artifactId>db2jcc</dep:artifactId>
                <dep:version>8.1.8</dep:version>
                <dep:type>jar</dep:type>
            </dep:dependency>
        </dep:dependencies>
    </dep:environment>
    <resourceadapter>
        <outbound-resourceadapter>
            <connection-definition>
                <connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>
                <connectiondefinition-instance>
                    <name>DB2_ds</name>
                    <config-property-setting name="Password">db2admin</config-property-setting>
                    <config-property-setting name="Driver">com.ibm.db2.jcc.DB2Driver</config-property-setting>
                    <config-property-setting name="UserName">db2admin</config-property-setting>
                    <config-property-setting name="ConnectionURL">jdbc:db2://localhost:50000/SAMPLE</config-property-setting>
                    <connectionmanager>
                        <local-transaction/>
                        <single-pool>
                            <max-size>10</max-size>
                            <min-size>0</min-size>
                            <match-one/>
                        </single-pool>
                    </connectionmanager>
                </connectiondefinition-instance>
            </connection-definition>
        </outbound-resourceadapter>
    </resourceadapter>
</connector>

Test Connection, you should see a confirmation message that you are connected to DB2.

Image Added

Click on Deploy. You should now have DB2_ds listed in the Database Pools portlet.

Image Added

Deploy a database conneciton pool using the command line

As an alternatively to the wizard you could create a deployment plan manually and deploy it using the command line based deployer tool. To use this option create a db2-plan.xml file and copy the content of the following example.

...

Once you saved this deployment plan you can click on Cancel at the bottom left corner of the Database Pool portlet.

Back to Top

Create the DB2 datasource deployment plan

Edit the db2-plan.xml file you just created and add the dependencies for the license jar files as illustrated in the following example.

...

Let's analyze this plan now. Take a look at the <dep:environment> section, there you can find the moduleId which identify the resource or component being deployed; in the Administration Console the moduleId is displayed in the Component Name column on the Database Pools portlet.

Right after the moduleId comes the definition of the dependencies. In this particular case you can find three <dep:dependency> blocks pertaining to the DB2 JDBC driver and the two lincese jars. The last "big" block in this plan is the <resourceadapter> where the connection paramenters such as driver, user and password, connection URL, etc. are defined.

Deploy the datasource

To the deploy the DB2 datasource you just created run the following command from the <geronimo_home>\bin directory.

deploy --user system --password manager deploy <dep_plan_home>\db2-plan.xml ..\repository\org\tranql\tranql-connector-ra\1.13\tranql-connector-ra-1.13.rar

You should receive the following message:

No FormatbgColor#000000borderStylesolid Esolid D:\geronimo-jetty-j2ee-1.12\bin>deploy --user system --password manager deploy \tmp\db2-plan.xml ..\repository\org\tranql\tranql-connector-ra\1.13\tranql-connector-ra-1.13.rar Using GERONIMO_BASE: ED:\geronimo-jetty-j2ee-1.1 2 Using GERONIMO_HOME: ED:\geronimo-jetty-j2ee-1.1 2 Using GERONIMO_TMPDIR: ED:\geronimo-jetty-j2ee-1.12\var\temp Using JRE_HOME: C:\j2sdk1Java\jdk1.45.2_09 Deployed 0_06\\jre Deployed console.dbpool/DB2_ds/1.0/rar

If you go back to the Database Pools portlet you should see the DB2_ds datasource listed in the portlet.

Image Removed

Back to Top