Versions Compared

Key

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

...

This article shows you how to configure a DB2 datasource in Apache Geronimo v2.1. Since the release of Geronimo v1.1, you can now select multiple drivers from the creation pool wizard on the Geronimo Administration Console.

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

The steps described in this article are valid for deploying any other datasource for which when you don't have the drivers already installed on the server and/or may require multiple driver files.

This article provides two alternatives to deploy the connection pool, the first approach we tackle is : using the Geronimo Administration Console , then we explain the process for and using the command line option.

...

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

  • db2jcc.jar - This is the actual DB2 Universal JDBC Driver jar file.
  • db2jcc_license_cu.jar - This is the standard DB2 Universal JDBC driver license file that allows access to the DB2 Universal database for Linux, UNIX and Windows servers.
  • db2jcc_license_cisuz.jar - This is the DB2 (DB2 ESE and DB2 Connect) JDBC Driver license for z/OS and iSeries that should be used in addition to the standard license for these servers.

...

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

Original name

Renamed

db2jcc.jar

db2jcc-8.1.8.jar

db2jcc_license_cu.jar

db2jcc_license_cu-8.1.8.jar

db2jcc_license_cisuz.jar

db2jcc_license_cisuz-8.1.8.jar

...

At this point you are ready to add those files to the Geronimo repository , to do that you have two alternativesin two ways. You can either use any graphical or command line tool to copy the files and create the necessary directories, or you use the Geronimo Administration Console and add the driver and licenses to the common libraries. Next we will cover both alternativesSee the following details.

Using command line

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

...

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

...

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

...

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

On In Step 1 of the create database pool wizard , enter the pool name and database type as illustrated in the following figure database pool wizard and then click Next. See illustration in the following figure.

On In Step 2, leave the JDBC Driver Class: field by default (com.ibm.db2.jcc.DB2Driver). If you click on the Driver JAR: pull-down menu you should now see the three com.ibm/db2... jars you copied in the repository. Since Geronimo v1.1 only allow you to select ONE jar file from this menu select the first jar on the list, com.ibm/db2jcc/8.1.8/jar which is the driver itself. You will add manually the license jars in the next steps.

...

Click Next.

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

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

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

...

Deploy a database connection pool using the command line

As an alternatively alternative to the wizard, you could can 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.

...

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

...

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.3\tranql-connector-ra-1.3.rar

You should will receive the following message:

...