Configuring DB2 Datasource
Skip to end of metadata
Go to start of metadata

Article donated by: Hernan Cunico

This article shows you how to configure a DB2 datasource in Apache Geronimo v1.0. Normally you would just use 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.

Add DB2 to the repository

Add a DB2 entry in the repository by creating a db2\jars directory in the Geronimo repository.



The db2\jars directory used in this article is just an example. As Apache Geronimo moves forward and use Maven2 for instance, all the content in the repository will be organized in packages. You may want to consider using a naming like in your testings and future implementations.

Copy the following files from <sqllib_home>\java to the <geronimo_home>\repository\db2\jars directory.

  • 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.

For additional information on the DB2 JDBC drivers and licenses visit the DB2 Information Center available at the following URL:

Rename the files you just copied so Geronimo can recognize them.

Original name








For this particular case DB2 v8.1.8.806 was used. Failing to rename these files will cause the server to throw an exception.

Back to Top

Create a template deployment plan

Start the Geronimo server by running the following command:

<geronimo_home>\bin\geronimo run

Once the server is started open the Geronimo Administration Console by pointing a Web browser to the following URL:


Enter system and manager as the username and password.

On the Console Navigation menu on the left select Database Pools and create a new pool by clicking on Using the Geronimo database pool wizard.

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

On Step 2 leave the JDBC Driver Class: field by default ( If you click on the Driver JAR: pull-down menu you should now see the three DB2 jars you copied in the repository.

Since Geronimo v1.0 only allow you to select ONE jar file from this menu select the first jar on the list, db2jcc-8.1.8.jar which is the driver itself. You will add manually the license jars in the next steps.

Enter the remanining connection information as shown in the following figure. For this example the default db2admin user and password was used and a SAMPLE database was created via the DB2 Control Center.

Click Next.

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

If you click on Test Connection now the connection will fail because you have not yet included the license files in the deployment plan.

Excerpt from the Test Result: Connection Error The version of the IBM Universal JDBC driver in use is not licensed for connectivity to QDB2/NT databases. 
To connect to this DB2 server, please obtain a licensed copy of the IBM DB2 Universal Driver for JDBC and SQLJ.
An appropriate license file db2jcc_license_*.jar for this target platform must be installed to the application classpath.
Connectivity to QDB2/NT databases is enabled by any of the following license files: { db2jcc_license_cu.jar, db2jcc_license_cisuz.jar }

Click on Skip Test and Show Plan.

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.

Wizard generated deployment plan

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.

Updated db2_plan.xml deployment plan

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 db2_plan.xml ..\repository\tranql\rars\tranql-connector-1.1.rar

You should receive the following message:

E:\geronimo\bin>deploy --user system --password manager deploy db2_plan.xml ..\repository\tranql\rars\tranql-connector-1.1.rar
    Deployed user/database-pool-DB2_Test/1/car

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

Back to Top

  • No labels
  1. Anonymous

    I'm not sure if I downloaded Geronimo from Apache's site or from IBM's, but I do not have a "show plan" option when creating a new database pool.  Just "Create" and then after that I can click on "detail" (which displays "error in portlet") or "test connection" which shows the license error.


    Is that "deployment plan" xml file located anywhere on the filesystem?  I would just grab it from there but I can't seem to find it.  There is a "config.ser" binary file in my config-store/##/ directory which looks like it could be it.  Why is this file non-human readable?  Doesn't seem to make much sense.