Setting Up a Test Database

Many of the examples cited within this user guide work with a relational database table or XML collection called littleblackbook. The example perform documents provided within OGSA-DAI/examples also use this table or collection. On this page we provide instructions for configuring databases so that you can use our examples.

Create an ogsadai Database

You should first set up a database within your database management system with the name ogsadai. This should ideally be given an associated username of ogsadai and password of ogsadai. If your database management system does not support usernames and passwords then that is fine. Your database management system instructions or your database administrator should be able to provide instructions for doing this. If you are using a MySQL database management system, a client is provided which can create the database for you, as described below. For other database management systems, the clients provided expect the database to already exist and only create the actual table or collection.

Create a littleblackbook Table or Collection

Having created an ogsadai database you now need to create littleblackbook table or collection. We provide a number of clients that you can use to build the table or collection, depending upon your database management system.

Set up your CLASSPATH

Before running any of the clients you must first set-up your classpath. To do this, you must ensure that the database driver JARs for your database are copied into the OGSA-DAI/lib directory of the OGSA-DAI binary distribution. Recommended database drivers are listed on the Data Resources page. Your classpath can then be configured by running the following scripts:

Common Arguments

Each client takes the following (optional) arguments:

To see a client's options and default settings:

$ java uk.org.ogsadai.client.dbcreate.CLIENT -help

For example:

$ java uk.org.ogsadai.client.dbcreate.CreateTestMySQLDB -help

MySQL: CreateTestMySQLDB Client

The CreateTestMySQLDB Client also supports the creation of the database itself, as well as the creation and population of the table within it. This can be invoked by the use of the following additional arguments:

To create a database and a table use, for example:

$ java uk.org.ogsadai.client.dbcreate.CreateTestMySQLDB
  -host localhost -port 3306 -database ogsadai -username ogsadai
  -password ogsadai -tablename littleblackbook -rows 10000
  -rootusername root -rootpassword passwd

eXist: CreateTestExistDB Client

To create a database collection, for example:

$ java uk.org.ogsadai.client.dbcreate.CreateTestExistDB
  -host localhost -port 8080 -database ogsadai
  -collectionname littleblackbook -documents 10000

DB2: CreateTestDB2DB Client

To create a database table use, for example:

$ java uk.org.ogsadai.client.dbcreate.CreateTestDB2DB
  -host localhost -port 50000 -database ogsadai -username ogsadai
  -password ogsadai -tablename littleblackbook -rows 10000

Oracle: CreateTestOracleDB Client

To create a database table use, for example:

$ java uk.org.ogsadai.client.dbcreate.CreateTestOracleDB
  -host localhost -port 1521 -database ogsadai -username ogsadai
  -password ogsadai -tablename littleblackbook -rows 1000000

PostgreSQL: CreateTestPostgreSQLDB Client

To create a database table use, for example:

$ java uk.org.ogsadai.client.dbcreate.CreateTestPostgreSQLDB
  -host localhost -port 5432 -database ogsadai -username ogsadai
  -password ogsadai -tablename littleblackbook -rows 10000

SQL Server: CreateTestSQLServerDB Client

To create a database table use, for example:

$ java uk.org.ogsadai.client.dbcreate.CreateTestSQLServerDB
  -host localhost -port 1433 -database ogsadai -username ogsadai
  -password ogsadai -tablename littleblackbook -rows 10000

File containing comma-separated values: CreateTestCsvDB Client

This client creates a file containing comma-separated values.

$ java uk.org.ogsadai.client.dbcreate.CreateTestCsvDB
  -directory DIRECTORY-FOR-FILE -filename CSV-FILE-NAME
  -delimiter CSV-DELIMITER -rows ROWS

For example:

$ java uk.org.ogsadai.client.dbcreate.CreateTestCsvDB
  -directory . -filename littleblackbook.csv -delimiter "," -rows 10000