Tuscany RDB DAS Database Setup Utility


This utility provides a jar file to be used by RDB DAS sample applications (web or standalone) to do database setup. So far the samples provided canned pre-created Derby database with tables and data. There was no convenient way to refresh table data during the samples execution. This utility supports Derby database at present and uses a config file to get the setup information.

APIs

Assumptions:

<table> element lists tables in proper sequence, i.e. parent tables first and then child tables. This sequence will be used in create,insert,delete,drop to take care of referential integrity. The config file required by utility supports the following features through different attributes and elements. Sample xml file is shown at the end.

<ConnectionInfo>

This element provides connection specific information - like vendor specific database URL, user name, password etc. If the DataSource is provided by the web container, user needs to only fill dataSource attribute in this. In case of standalone J2SE samples, user needs to fill ConnectionProperties element inside ConnectionInfo. These two ways of connection specification are mutually exclusive.

<table>

This element needs to specify the table names required by the sample. Only these tables will be considered for creation, data population. This gives flexibility to the user to choose the required set of tables based on the sample's requirement. It also needs to specify in the attributes, the Create SQL command used to create this table.<table> has sequence element <row> which is used to provide the data to be populated in the table.

Set Up

To use this utility, include its jar and required database driver's jar in the classpath. Provide the config file used by this utility , similar to the example below, in the source folder of the sample.

DBConfig.xml example