uk.org.ogsadai.client.dbcreate2
Class CreateTestOracleDB
java.lang.Object
|
+--uk.org.ogsadai.client.dbcreate2.CreateTestDB
|
+--uk.org.ogsadai.client.dbcreate2.CreateTestOracleDB
- public class CreateTestOracleDB
- extends CreateTestDB
CreateTestOracleDB.java This program will create three tables in an Oracle database called example_{destination,traveller,booking} and populate them with a total of 40,000 entries. The mRows field may be modified to generate a table 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.CreateTestOracleDB [-driverclass OracleDriverClass] [-host OracleHostName] [-port OraclePortNumber] [-database OracleDatabaseName] [-username OracleUserName] [-password OraclePassword] [-tablename NameOfTableToCreate] [-rows NumberOfRowsToCreate] Default Settings: OracleDriverClass: oracle.jdbc.driver.OracleDriver OracleHostName: localhost OraclePortNumber: 1521 OracleDatabaseName: ogsadai OracleUserName: scott OraclePassword: tiger PrefixOfTablesToCreate: example_ NumberOfRowsToCreate: 40000
- Author:
- The OGSA-DAI Project Team
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 |
CreateTestOracleDB(java.lang.String[] args)
Creates and populates a Oracle 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 tablename)
Drops the specified table. |
protected java.sql.Connection |
getConnection()
Returns a java.sql.Connection data resource. |
protected java.lang.String |
getCreateBookingTableStatement()
Constructs the statement for creating the traveller table. |
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
COPYRIGHT_NOTICE
private static final java.lang.String COPYRIGHT_NOTICE
-
- See Also:
- Constant Field Values
CreateTestOracleDB
public CreateTestOracleDB(java.lang.String[] args)
-
Creates and populates a Oracle test database table according to the specified settings or the default settings if no arguments are used.
- Parameters:
args
- arguments passed to the main method.
main
public static void main(java.lang.String[] args)
-
setDefaultSettings
protected void setDefaultSettings()
- Description copied from class:
CreateTestDB
-
Sets the default settings for the client.
-
- Specified by:
setDefaultSettings
in class CreateTestDB
-
getConnection
protected java.sql.Connection getConnection()
throws java.sql.SQLException
- Description copied from class:
CreateTestDB
-
Returns a
java.sql.Connection
data resource.
-
- Specified by:
getConnection
in class CreateTestDB
-
- Returns:
- Connection
- Throws:
java.sql.SQLException
dropTableIfExists
protected void dropTableIfExists(java.sql.Connection connection,
java.lang.String tablename)
throws java.sql.SQLException
- Description copied from class:
CreateTestDB
-
Drops the specified table. Note: This method must not throw an error if the table does not exist.
-
- Specified by:
dropTableIfExists
in class CreateTestDB
-
- Parameters:
connection
- a connection to the data resource
tablename
- the name of the table to be created
- Throws:
java.sql.SQLException
getCreateDestinationTableStatement
protected java.lang.String getCreateDestinationTableStatement()
- Description copied from class:
CreateTestDB
-
Constructs the statement for creating a destination table. Subclasses can override this method if the statement differs.
-
- Overrides:
getCreateDestinationTableStatement
in class CreateTestDB
-
- Returns:
- String a create table statement
getCreateBookingTableStatement
protected java.lang.String getCreateBookingTableStatement()
- Description copied from class:
CreateTestDB
-
Constructs the statement for creating the traveller table. Subclasses can override this method if a data resource uses a different statement.
-
- Overrides:
getCreateBookingTableStatement
in class CreateTestDB
-
- Returns:
- a create table statement