uPortal by JA-SIG
.

JA-SIG Home

About uPortal

Documentation

Getting Started

Developers

Implementors

Users

Background

Release

Meeting Minutes

.

Setting up A DB2 Database

Overview
DB2 is a commercial database from IBM. The DB2 database software is availble from IBM at:
http://www.ibm.com/software/data/db2/
Obtaining the Driver

A JDBC DB2 driver is included in the DB2 software in the java subdirectory after DB2 installation has been performed. The file db2java.zip should be copied to a location that is accessible from the uPortal build environment (for example, /usr/local/java/db2/lib/db2jdbc.zip).

See Issues section about possible issues using this driver.

Properties Configuration

The uPortal build.properties may need to be modifed. Find the property called jdbcDriver and change it to point to the DB2 jar file, for example:

jdbcDriver.jar=./lib/db2java.zip

The uPortal rdbm.properties file (in the properties directory) may need to modified to specify the driver properties. The rdbm.properties file contains several sample entries. Uncomment (or add) the lines for the DB2 database and make whatever changes necessary to match your local database installation, For example:

#### DB2
jdbcDriver=COM.ibm.db2.jdbc.net.DB2Driver
jdbcUrl=jdbc:db2://localhost/uportal
jdbcPassword=sa
jdbcPassword=

The dbloader.xml properties file (also in the properties directory) may also need to be modified. This file is used by the DbLoader tool to create the uPortal database tables and populate the database. It contains several sample entries which create db-type-mappings for different databases. Find the tags for an DB2 database and modify the db-version, driver-name, and driver-version as necessary. For example:

<db-type-mapping>
  <db-name>DB2</db-name>
  <db-version>7.2</db-version>
  <driver-name>DB2 Driver</driver-name>
  <driver-version>7.2</driver-version>
  <type><generic>INTEGER</generic><local>INTEGER</local></type>
  <type><generic>VARCHAR</generic><local>VARCHAR</local></type>
  <type><generic>LONGVARCHAR</generic><local>LONGVARCHAR</local></type>
  <!-- map more types here -->
</db-type-mapping>

The PersonDirs.xml file (also in the properties directory) may need to be modified; This file is used if the database is to be used to provide user directory information

<!-- JDBC Properties -->
<driver>org.hsqldb.jdbcDriver</driver>
<url>jdbc:db2://localhost/uportal</url>
<logonid>sa</logonid>
<logonpassword></logonpassword>,
<uidquery>SELECT FIRST_NAME||' '||LAST_NAME AS FIRST_LAST,
FIRST_NAME, LAST_NAME, EMAIL FROM UP_PERSON_DIR WHERE USER_NAME=?></uidquery>
Loading the Database

Loading the database requires a couple of steps

  • Create the database: Refer to the DB2 database documentation for instructions regarding how to create an DB2 database instance. DB2 uses a properties file for describing and tuning the database. The properties in that file will need to match definitions in the rdbm.properties file.
  • Create the tables and populate the database: From the uPortal build directory, run "ant db" to execute the ant target which loads the database. The ant target uses the Dbloader tool.
Issues and Known Bugs

Some people have encountered problems with database drivers with certain web application environments if the classes zip file is used as-is with the .zip file extension. Simply renaming the file to a .jar file seems to fix the problem. Alternatively, unzipping the classes file into a directory structure, then using the jar command to repackage the classes into a jar file works as well.

.

 
.
JA-SIG Home * About uPortal * FAQ * Download * Documentation * Getting Involved *
Code Repository * Reporting Bugs * License *