|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--uk.org.ogsadai.client.dbcreate2.CreateTestDB | +--uk.org.ogsadai.client.dbcreate2.CreateTestMySQLDB
This program will populate three tables in a MySQL database called example_{traveller,destination,booking} and populate them with a total of 40,000 entries.
The rows field may be modified to generate tables with any desired number of rows. The nth row in each possible database will be identical across each one which has at least n rows (assuming Random is implemented the same on all Java jdks).
Usage:
java uk.org.ogsadai.client.dbcreate.CreateTestMySQLDB [-driverclass MySQLDriverClass]
[-host MySQLHostName] [-port MySQLPortNumber] [-database MySQLDatabaseName]
[-username MySQLUserName] [-password MySQLPassword]
[-tablename NameOfTableToCreate] [-rows NumberOfRowsToCreate]
Default Settings:
MySQLDriverClass: org.gjt.mm.mysql.Driver
MySQLHostName: localhost
MySQLDatabaseName: ogsadai
MySQLUserName: ogsadai
MySQLPassword: ogsadai
PrefixOfTablesToCreate: example_
NumberOfRowsToCreate: 40000
MySQLRootUserName: root
MySQLRootPassword:
Field Summary | |
private static java.lang.String |
COPYRIGHT_NOTICE
|
Fields inherited from class uk.org.ogsadai.client.dbcreate2.CreateTestDB |
mBookingTable, mData, mDatabase, mDBMS, mDestinationTable, mDriver, mHost, mNumberOfBookings, mNumberOfDestinations, mNumberOfTravellers, mPassword, mPort, mRows, mSizeOfBlob, mTablePrefix, mTravellerTable, mUsername |
Constructor Summary | |
CreateTestMySQLDB(java.lang.String[] args)
Creates and populates a MySQL test database table according to the specified settings or the default settings if no arguments are used. |
Method Summary | |
protected void |
dropTableIfExists(java.sql.Connection connection,
java.lang.String table)
Drops the specified table. |
protected java.sql.Connection |
getConnection()
Returns a java.sql.Connection data resource. |
protected java.lang.String |
getCreateDestinationTableStatement()
Constructs the statement for creating a destination table. |
static void |
main(java.lang.String[] args)
|
protected void |
setDefaultSettings()
Sets the default settings for the client. |
Methods inherited from class uk.org.ogsadai.client.dbcreate2.CreateTestDB |
createBookingTable, createDestinationTable, createTravellerTable, getCreateBookingTableStatement, getCreateTravellerTableStatement, loadDriver, populateDatabase, printUsage, printVariables, setupArguments |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final java.lang.String COPYRIGHT_NOTICE
Constructor Detail |
public CreateTestMySQLDB(java.lang.String[] args)
args
- arguments passed to the main method.Method Detail |
public static void main(java.lang.String[] args)
protected void setDefaultSettings()
CreateTestDB
setDefaultSettings
in class CreateTestDB
protected java.sql.Connection getConnection() throws java.sql.SQLException
CreateTestDB
java.sql.Connection
data resource.
getConnection
in class CreateTestDB
java.sql.SQLException
protected void dropTableIfExists(java.sql.Connection connection, java.lang.String table) throws java.sql.SQLException
CreateTestDB
dropTableIfExists
in class CreateTestDB
connection
- a connection to the data resourcetable
- the name of the table to be created
java.sql.SQLException
protected java.lang.String getCreateDestinationTableStatement()
CreateTestDB
getCreateDestinationTableStatement
in class CreateTestDB
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |