Datagenerator : Example Walkthrough

This example uses the schema "Order Entry" generated  by Swingbench's oewizard tool.


To start datagenerator in Unix/Linux simply issue the following command
[oracle@dgiles-uk:bin] $ cd datagenerator
[oracle@dgiles-uk:bin] $ ./datagenerator

In Windows (simply double click the datagenerator.bat icon in the winbin directory)
C\:> cd winbin
C\:> datagenerator.bat

This will launch datagenerator

By default datagenerator will use a file datagenerator.xml file located in the bin directory this can be overridden with the -c command line option.

Press the icon to create a new  profile.

Press the wizard  icon to reverse engineer a database schema, This will launch the following window

Enter your user details and hit test to validate your connection details.

The connection string will be of the form
Thin (pure java)//<>:<>:<> or <>:<>:<> i.e //node1:1521/RAC
OCI (java callout to Oracle's oci layer)//<>:<> or tnsnames entry i.e //node1/RAC

To remove all of the existing entries in the profile on completion select the checkbox.

The following screen shows tables that can be selcted to build a a datagenerator profile with...

Select the tables your interested in from the left hand column and move them to the right hand side, either by using the buttons or dragging them across. Press next.

Datagenerator will validate the tables columns to determine if it supports their data types. Press finish to create the datagenerator profile.
Datagenerator will create a profile with default generators for each column based on their data type. Its is now possible to generate a data run by pressing theicon

This will launch the following window

It will create a directory with the following files with in it
File Type Description
<tablename>.dat or <tablename>.dat.gz (if compression is used) Table data in comma seperated format
<tablename>.ctl The control file for sqlldr to load a file into the database
createtables.sql sql script used to create table definitions
constraints.sql sql script containing constraint definitions (primary keys presently)
droptables.sql sql script used to drop tables

However it s likely that you may want to refine  a tables definition a little further, lets use the customers table. Expand the cutomers table by pressing on the "+"

Select the first cust_first_name column and expand it further with the "+". This will display its default generator of type text. We can change this type to a more realistic data set by using a file of "typical" data. Datagenerator ships with some simple sample data which we can use to populate this column with. It will create the list in memory and randomly select one. Change the datagenerator type to file and press the icon. The sample data is located in the sample directory of the bin or winbin directory. Select the "lowerfirstnames.txt" file. You should end up with a form that looks similar to this

Its also worth changing the email column to give it a more realistic size and data  profile.  Select and expand the  "Cust_email" column.  Change the existing datgenerator to type "File" and select populate it as before with the lowerfirstnames.txt. However this time also enter "@" in the postfix field. Its also possible to have multiple datgenerators per column. To add an additional datagenerator right click on the "Cust_email" column and select Add column generator.

Change this datagenerators type to character (Alpha Numeric) and set its min and max length to 7 and 10 respectively. This will generate data in the form "dominic@DSHsa6A"

Datagenerator also allows for the creation of master detail releationships between tables and will generate the appropriate foreign key data.

Select the "ORDER_ITEMS" table and select the "Model Parent Child Relationship" This will allow you to select the parent table (ORDERS), primary key (ORDER_ID) and foreign key (ORDER_ID).  Its also possible to  get a datagenerator to reset its value for each new primary key in the primary table, in this case the "LINE_ITEM_ID".

The amount of data created for a child table is directly related to the number of rows in the parent table and the minimum and maximum relationship count.

Once you've completed your changes its possible to save them using the "File" menu or the save icon.