uPortal by JA-SIG
.

JA-SIG Home

About uPortal

Documentation

Getting Started

Developers

Implementors

Users

Background

Release

.

Dbloader/DbUnload database management tools

DbLoader

The reference implementation of uPortal's data storage interfaces requires a relational database. uPortal provides a tool, DbLoader, to load a relational database with the required uPortal tables and sample data.

DbLoader performs the following tasks:

  1. Reads in properties/tables.xml file to determine the database schema
  2. Deletes existing tables specified in tables.xml.
  3. Creates the tables specified in tables.xml.
  4. Reads in properties/data.xml file to determine sample data.
  5. Inserts data from data.xml into the newly created tables.
  6. Creates a database script containing all the SQL statements previously executed.

DbLoader can be configured by modifying properties/dbloader.xml. Because DbLoader relies on database metadata supplied by a JDBC driver, it may be necessary (for some combinations of drivers and databases) to supply a datatype mapping inside dbloader.xml. If this is necessary, DbLoader will print an error message with instructions.

To run DbLoader, type "ant db" from the uPortal base directory.

The "db" target accepts command line arguments which override values read from the dbloader.xml file.

The "db" target can be invoked thusly:

To use /properties/mytables.xml instead of the tables file specified in dbloader.xml:

ant db -Dusetable=-t -Dtablefile=/properties/mytables.xml

To use /properties/mydata.xml instead of the data file specified in dbloader.xml:

ant db -Dusedata=-d -Ddatafile=/properties/mydata.xml

Note: the tables and data files can both be overridden by combining the arguments. The usetable and tablefile must be used in tandem and sequentially on the command line. Similarly, usedata and datafile must but used in tandem.

Addtionally, several other boolean flags may be overridden.

To set createScript=true

ant db -Dcreatescript=-c

To set createScript=false

ant db -Dcreatescript=-nc

To set dropTables=true

ant db -Ddroptables=-D

To set dropTables=false

ant db -Ddroptables=-nD

To set createTables=true

ant db -Dcreatetables=-C

To set createTables=false

ant db -Dcreatetables=-nC

To set populateTables=true

ant db -Dpopulatetables=-P

To set populateTables=false

ant db -Dpopulatetables=-nP

The -c, -nc, -D, -nD, -C, -nC, -P, -nP arguements may all be used independantly or in any combination although it would not make sense to, for example, use both -c and -nc.

DbUnload

DbUnload, can read an existing database table and serialize it into an xml file similar to tables.xml. This file can then be used in place of tables.xml to load another database.

To run this target, you must specify the table name and output file parameters
on the command line. For example:

ant dbunload -Dtablename=up_channel -Dxmlfile=mytables.xml

 

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