|
Hyperic HQ Plugin API v. 4.4.0.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hyperic.tools.db.DBPing
public class DBPing
DBPing is a tool for testing that a given JDBC driver can be loaded an a connection to a database established. In addition, DBPing can run a simple performance test which does the following: 1. Creates a table 2. Inserts records (1000 records by default; this can be overriden) 3. Commits 4. Deletes the records 5. Commits 6. Drops the table DBPing can be run from the command line using the command: java org.hyperic.tools.db.DBPing Your JDBC driver should be in your classpath, as well as the DBPing class. DBPing can also be called directly from another class. To do this instantiate the DBPing class and then call the DBPing.ping() method. The DBPing.speedTest() method call also be used to run a performance test.
Constructor Summary | |
---|---|
DBPing()
Constructs a DBPing class with quiet mode turned on. |
|
DBPing(boolean quiet)
Constructs a DBPing class with quiet mode turned on or off. |
Method Summary | |
---|---|
boolean |
isQuiet()
Retrieves whether status messages will be printed to System.out. |
static void |
main(java.lang.String[] args)
|
void |
operationTest(java.lang.String database)
Runs an operation test by creating a table, creating an index, creating a sequence, creating a trigger, inserting a row of data, updating a row of data and deleting a row of data. |
void |
operationTest(java.lang.String driver,
java.lang.String database)
Runs an operation test by creating a table, creating an index, creating a sequence, creating a trigger, inserting a row of data, updating a row of data and deleting a row of data. |
void |
operationTest(java.lang.String driver,
java.lang.String database,
java.lang.String username,
java.lang.String password)
Runs an operation test by creating a table, creating an index, creating a sequence, creating a trigger, inserting a row of data, updating a row of data and deleting a row of data. |
void |
ping(java.lang.String database)
Loads the specified JDBC driver and connects to the specified database. |
void |
ping(java.lang.String driver,
java.lang.String database)
Loads the specified JDBC driver and connects to the specified database. |
void |
ping(java.lang.String driver,
java.lang.String database,
java.lang.String username,
java.lang.String password)
Loads the specified JDBC driver and connects to the specified database. |
protected void |
print(char c)
|
protected void |
print(java.lang.String s)
|
protected void |
println()
|
protected void |
println(java.lang.String s)
|
protected void |
printSuccess()
|
protected void |
printTime(long time)
|
void |
setQuiet(boolean quiet)
Sets whether status messages will be printed to System.out. |
long |
speedTest(java.lang.String driver,
java.lang.String database,
java.lang.String username,
java.lang.String password)
Runs a speed test by creating a table, inserting a specified number of rows into a table, committing, deleting the rows committing and then dropping the table. |
long |
speedTest(java.lang.String driver,
java.lang.String database,
java.lang.String username,
java.lang.String password,
int numrecs)
Runs a speed test by creating a table, inserting a specified number of rows into a table, committing, deleting the rows committing and then dropping the table. |
long |
speedTest(java.lang.String driver,
java.lang.String database,
java.lang.String username,
java.lang.String password,
int numrecs,
int threads)
Runs a multi-threaded speed test by creating a table, inserting a specified number of rows into a table, committing, deleting the rows committing and then dropping the table. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DBPing()
public DBPing(boolean quiet)
quiet
- Status messages are sent to std out if true, no message otherwise.Method Detail |
---|
public static void main(java.lang.String[] args)
public void operationTest(java.lang.String database) throws java.lang.ClassNotFoundException, java.sql.SQLException
database
- The JDBC driver connect string (e.g., "jdbc:cloudscape:test")
java.lang.ClassNotFoundException
java.sql.SQLException
public void operationTest(java.lang.String driver, java.lang.String database) throws java.lang.ClassNotFoundException, java.sql.SQLException
driver
- The Java class name of the JDBC driver (e.g., "COM.cloudscape.core.JDBCDriver").
This paramater can be null in which case the proper driver is loaded
automatically, based on the specified database.database
- The JDBC driver connect string (e.g., "jdbc:cloudscape:test")
java.lang.ClassNotFoundException
java.sql.SQLException
public void operationTest(java.lang.String driver, java.lang.String database, java.lang.String username, java.lang.String password) throws java.lang.ClassNotFoundException, java.sql.SQLException
driver
- The Java class name of the JDBC driver (e.g., "COM.cloudscape.core.JDBCDriver").
This paramater can be null in which case the proper driver is loaded
automatically, based on the specified database.database
- The JDBC driver connect string (e.g., "jdbc:cloudscape:test")username
- The username to use when connecting to the database. This value can
be null.password
- The password to use when connecting to the database. This value can
be null.
java.lang.ClassNotFoundException
java.sql.SQLException
public void ping(java.lang.String database) throws java.lang.ClassNotFoundException, java.sql.SQLException
database
- The JDBC driver connect string (e.g., "jdbc:cloudscape:test")
java.lang.ClassNotFoundException
java.sql.SQLException
public void ping(java.lang.String driver, java.lang.String database) throws java.lang.ClassNotFoundException, java.sql.SQLException
database
- The JDBC driver connect string (e.g., "jdbc:cloudscape:test")driver
- The Java class name of the JDBC driver (e.g., "COM.cloudscape.core.JDBCDriver").
java.lang.ClassNotFoundException
java.sql.SQLException
public void ping(java.lang.String driver, java.lang.String database, java.lang.String username, java.lang.String password) throws java.lang.ClassNotFoundException, java.sql.SQLException
driver
- The Java class name of the JDBC driver (e.g., "COM.cloudscape.core.JDBCDriver").
This paramater can be null in which case the proper driver is loaded
automatically, based on the specified database.database
- The JDBC driver connect string (e.g., "jdbc:cloudscape:test")username
- The username to use when connecting to the database. This value can
be null.password
- The password to use when connecting to the database. This value can
be null.
java.lang.ClassNotFoundException
java.sql.SQLException
public long speedTest(java.lang.String driver, java.lang.String database, java.lang.String username, java.lang.String password) throws java.lang.ClassNotFoundException, java.sql.SQLException
database
- The JDBC driver connect string (e.g., "jdbc:cloudscape:test")username
- The username to use when connecting to the database. This value can
be null.password
- The password to use when connecting to the database. This value can
be null.numrecs
- The number of records to create and delete.
java.lang.ClassNotFoundException
java.sql.SQLException
public long speedTest(java.lang.String driver, java.lang.String database, java.lang.String username, java.lang.String password, int numrecs) throws java.lang.ClassNotFoundException, java.sql.SQLException
database
- The JDBC driver connect string (e.g., "jdbc:cloudscape:test")username
- The username to use when connecting to the database. This value can
be null.password
- The password to use when connecting to the database. This value can
be null.numrecs
- The number of records to create and delete.
java.lang.ClassNotFoundException
java.sql.SQLException
public long speedTest(java.lang.String driver, java.lang.String database, java.lang.String username, java.lang.String password, int numrecs, int threads) throws java.lang.ClassNotFoundException, java.sql.SQLException
database
- The JDBC driver connect string (e.g., "jdbc:cloudscape:test")username
- The username to use when connecting to the database. This value can
be null.password
- The password to use when connecting to the database. This value can
be null.numrecs
- The number of records to create and delete.threads
- The number of threads to use in the speed test.
java.lang.ClassNotFoundException
java.sql.SQLException
public boolean isQuiet()
public void setQuiet(boolean quiet)
quiet
- true if status messages should be printed, false otherwise.protected void print(char c)
protected void print(java.lang.String s)
protected void println()
protected void println(java.lang.String s)
protected void printSuccess()
protected void printTime(long time)
|
Hyperic HQ Plugin API v. 4.4.0.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |