Database test Tool dbmonster use: Int type primary key, foreign key, varchar type data Generation __ Database

Source: Internet
Author: User
Tags file copy generator create database

If you have not yet understood what dbmonster is, please check the dbmonster introduction, download the installation

Pre-Preparation:

Ready to use MySQL for testing, if you have not installed MySQL Please install first, and then download the MySQL JDBC driver, unzip the Mysql-connector-java-5.1.17-bin.jar file copy to

The Dbmonster-core-1.0.3\lib directory.

Create DATABASE test, new table Parent,child

CREATE DATABASE test;

CREATE TABLE Parent
(
ID INT not NULL,
PRIMARY KEY (ID)
) Engine=innodb;
CREATE TABLE Child
(
ID int, parent_id int,
ChildName VARCHAR () DEFAULT NULL,
INDEX Par_ind (parent_id),
PRIMARY KEY (ID),
FOREIGN KEY (parent_id) REFERENCES parent (ID)
On DELETE CASCADE
) Engine=innodb;


Modify configuration file dbmonster.properties:


Dbmonster.jdbc.driver=com.mysql.jdbc.driver
Dbmonster.jdbc.url=jdbc:mysql://192.168.159.144:3306?dbmonster?charset=iso-8859-2
Dbmonster.jdbc.username=root
dbmonster.jdbc.password=123456
Dbmonster.jdbc.transaction.size=50

# for Oracle and other schemas enabled databases
Dbmonster.jdbc.schema=test

# maximal number of (re) tries
dbmonster.max-tries=1000

# Default rows number for Schemagrabber
dbmonster.rows=1000

# Progres Monitor Class
Dbmonster.progress.monitor=pl.kernelpanic.dbmonster.progressmonitoradapter


schema file for Dbmonster
The schema file describes the rules that produce data, in Dbmonster, the generation of data is generated through generator, and the default data generator in Dbmonster includes two key generator (for generating data that is not duplicated). Maxkeygenerator and Stringkeygenerator) and 10 data generator respectively. The following is a brief description of the use of data generator.
Binarygenerator is used to get binary data from an external file and insert the corresponding field, which has two properties that describe the data source for the file and Nulls,file properties, and the Nulls property gives the probability that the field will generate null.
Booleangenerator is used to produce bool-type data, which includes two properties that describe the probability that the probability and nulls,probability attributes produce true Value data, respectively, in the generator. The Nulls property gives the probability of generating null.
Constantgenerator is used to produce a fixed value of the data, the generator only one attribute constant, given the value to insert the database;
Datetimegenerator is used to produce datetime data, which includes four properties, namely, Startdate,enddate,returnedtype and Nulls, StartDate describes the start time, EndDate describes the expiration time, in the form "Yyyy-mm-dd Hh24:MM:ss", and Returnedtype describes the type of data generated, which can be date, time, or timestamp;
Directorygenerator is used to insert data into a database based on entries in a local file (dictionary), which includes two properties, Dictfile and Unique,dictfile, respectively, indicating the location of the dictionary file. The unique indication of whether the data produced is unique or random;
Foreignkeygenerator is used to generate data for a field that has a foreign key set, which contains two properties, TableName and columnname,tablename indicating the table name of the foreign key reference, respectively. ColumnName indicates the name of the field referenced by the foreign key;
Nullgenerator is used to produce data of a null type with no arguments (null only) generator;
Numbergenerator the user produces a numeric type of data that includes 5 properties, namely, MinValue, MaxValue, Returnedtype, scale, and nulls. The MinValue and MaxValue respectively give the bottom bounds and upper boundary of the resulting value; Returnedtype gives the type of data to be generated, which can be short, integer, long, float, double, and numeric types ; scale indicates the number of decimal digits; nulls indicates the probability of producing null;
Stringgenerator is used to produce data of a string type, which includes 5 properties, namely, MinLength, MaxLength, Allowspaces, Excludechars, and nulls. where minlength and maxlength limit the string length, whether the Allowspaces control string contains spaces, excludechars exclude characters that are not used when the string is generated, and nulls the probability of generating null;

For each generator properties please go to dbmonster-core-1.0.3/docs/manual/index.html view.


To Modify the Dbmonster.properties file:


Attention:

Foreignkeygenerator tablename,columnname refers to the table name and field name of the primary table


You can now use Dbmonster to create random data. The order is as follows:

Dbmonster.bat-c dbmonster.proprities-s Dbmonster-schema.xml

Execution Success Screenshot:


Child table Partial Data screenshot:




If you need a database to create files, dbmonster.properties,dbmonster-schema.xml files, please go to Http://u.115.com/file/clg2kvec download





Reference articles:

Http://www.docin.com/p-112799295.html

Dbmonster data Generation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.