Hyperic HQ Plugin API v. 4.4.0.2

org.hyperic.util.jdbc
Class JDBC

java.lang.Object
  extended by org.hyperic.util.jdbc.JDBC

public final class JDBC
extends java.lang.Object

JDBC is a utility class of JDBC helper methods. The primary methods are JDBC.getDriverString(), which given a simple database name like 'oracle' returns the full jdbc driver string 'oracle.jdbc.driver.OracleDriver'.


Field Summary
static java.lang.String CLOUDSCAPE_NAME
          Cloudscape JDBC driver class name.
static int CLOUDSCAPE_TYPE
           
static java.lang.String COVLOG_NAME
          Covalent JDBC-Log driver class name
static int COVLOG_TYPE
           
static java.lang.String INSTANTDB_NAME
          Lutris InstantDB JDBC driver class name.
static int INSTANTDB_TYPE
           
static java.lang.String MYSQL_NAME
          MySQL JDBC driver class name.
static int MYSQL_TYPE
           
static java.lang.String ORACLE_NAME
          Oracle JDBC driver class name.
static java.lang.String ORACLE_THIN_NAME
          Oracle JDBC driver class name.
static int ORACLE_THIN_TYPE
           
static int ORACLE_TYPE
           
static java.lang.String PGSQL_NAME
          PostgreSQL JDBC driver class name.
static int PGSQL_TYPE
           
static java.lang.String POINTBASE_NAME
          Pointbase JDBC driver class name.
static int POINTBASE_TYPE
           
 
Constructor Summary
JDBC()
           
 
Method Summary
static java.lang.String getCmpAdapterFactory(java.lang.String driver)
          Returns the correct jdbc adapter class factory for CMP
static java.lang.String getConnectionString(java.lang.String driver)
          Retrieves the JDBC Connection String for the specified driver.
static java.lang.String getConnectionString(java.lang.String driver, java.lang.String database)
          Retrieves the full JDBC Connection String for the specified driver.
static java.lang.String getDriverString(java.lang.String database)
          Retrieves the full JDBC Driver String from the database name.
static void loadDriver(java.lang.String database)
          Loads the JDBC driver from the driver short name (e.g., oracle) or the driver full name (e.g., oracle.jdbc.driver.OracleDriver).
static void printSQLException(java.sql.SQLException e)
          Prints a SQLException including the error code and child exceptions to System.out .
static void printSQLException(java.sql.SQLException e, java.io.PrintWriter out)
          Prints a SQLException including the error code and child exceptions to System.out .
static java.lang.String toName(int database)
          Retrieves the database name for the specified type id.
static java.lang.String toName(java.lang.String database)
           
static int toType(java.lang.String database)
          Retrieves the type id for the specified database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLOUDSCAPE_NAME

public static final java.lang.String CLOUDSCAPE_NAME
Cloudscape JDBC driver class name.

See Also:
Constant Field Values

CLOUDSCAPE_TYPE

public static final int CLOUDSCAPE_TYPE
See Also:
Constant Field Values

INSTANTDB_NAME

public static final java.lang.String INSTANTDB_NAME
Lutris InstantDB JDBC driver class name.

See Also:
Constant Field Values

INSTANTDB_TYPE

public static final int INSTANTDB_TYPE
See Also:
Constant Field Values

ORACLE_NAME

public static final java.lang.String ORACLE_NAME
Oracle JDBC driver class name.

See Also:
Constant Field Values

ORACLE_TYPE

public static final int ORACLE_TYPE
See Also:
Constant Field Values

PGSQL_NAME

public static final java.lang.String PGSQL_NAME
PostgreSQL JDBC driver class name.

See Also:
Constant Field Values

PGSQL_TYPE

public static final int PGSQL_TYPE
See Also:
Constant Field Values

ORACLE_THIN_NAME

public static final java.lang.String ORACLE_THIN_NAME
Oracle JDBC driver class name.

See Also:
Constant Field Values

ORACLE_THIN_TYPE

public static final int ORACLE_THIN_TYPE
See Also:
Constant Field Values

COVLOG_NAME

public static final java.lang.String COVLOG_NAME
Covalent JDBC-Log driver class name

See Also:
Constant Field Values

COVLOG_TYPE

public static final int COVLOG_TYPE
See Also:
Constant Field Values

POINTBASE_NAME

public static final java.lang.String POINTBASE_NAME
Pointbase JDBC driver class name.

See Also:
Constant Field Values

POINTBASE_TYPE

public static final int POINTBASE_TYPE
See Also:
Constant Field Values

MYSQL_NAME

public static final java.lang.String MYSQL_NAME
MySQL JDBC driver class name.

See Also:
Constant Field Values

MYSQL_TYPE

public static final int MYSQL_TYPE
See Also:
Constant Field Values
Constructor Detail

JDBC

public JDBC()
Method Detail

getConnectionString

public static java.lang.String getConnectionString(java.lang.String driver)
Retrieves the JDBC Connection String for the specified driver. The end of the string including the name of the database to connect to and other options must be appended to the end of the returned string before using the string in a JDBC call.

Parameters:
driver - The JDBC driver name. The name can be in full name (e.g., "COM.cloudscape.core.JDBCDriver") or short name (e.g., "cloudscape") form.
Returns:
String The JDBC connection string.

getCmpAdapterFactory

public static java.lang.String getCmpAdapterFactory(java.lang.String driver)
Returns the correct jdbc adapter class factory for CMP

Parameters:
driver - The JDBC driver name. The name can be in full name (e.g., "COM.cloudscape.core.JDBCDriver") or short name (e.g., "cloudscape") form.
Returns:
String The CMP adapter class factory name

getConnectionString

public static java.lang.String getConnectionString(java.lang.String driver,
                                                   java.lang.String database)
Retrieves the full JDBC Connection String for the specified driver.

Parameters:
driver - The JDBC driver name. The name can be in full name (e.g., "COM.cloudscape.core.JDBCDriver") or short name (e.g., "cloudscape") form.
database - The database name to append to the JDBC connection string.
Returns:
String The JDBC connection string.

getDriverString

public static java.lang.String getDriverString(java.lang.String database)
Retrieves the full JDBC Driver String from the database name. The database name can be a short name like cloudscape or a full jdbc connection string like jdbc:cloudscape:.

Parameters:
database - The database name.
Returns:
String The full JDBC Driver String (e.g., "COM.cloudscape.core.JDBCDriver") that corresponds the the short driver name.

loadDriver

public static void loadDriver(java.lang.String database)
                       throws java.lang.ClassNotFoundException
Loads the JDBC driver from the driver short name (e.g., oracle) or the driver full name (e.g., oracle.jdbc.driver.OracleDriver).

Parameters:
driver - The short or full name of the JDBC driver. throws ClassNotFoundException If the driver name does not specify a valid driver.
Throws:
java.lang.ClassNotFoundException

printSQLException

public static void printSQLException(java.sql.SQLException e)
Prints a SQLException including the error code and child exceptions to System.out .

Parameters:
e - The SQLException object.
See Also:
SQLException

printSQLException

public static void printSQLException(java.sql.SQLException e,
                                     java.io.PrintWriter out)
Prints a SQLException including the error code and child exceptions to System.out .

Parameters:
e - The SQLException object.
out - The java.io.PrintWriter to print the to.
See Also:
PrintWriter, SQLException

toName

public static java.lang.String toName(int database)
Retrieves the database name for the specified type id.

Parameters:
database - The database type id.
Returns:
String The name of the database.

toName

public static java.lang.String toName(java.lang.String database)

toType

public static int toType(java.lang.String database)
Retrieves the type id for the specified database.

Parameters:
database - The database name.
Returns:
int The type id of the database.

Hyperic HQ Plugin API v. 4.4.0.2

Copyright © 2004-2006 Hyperic, Inc. support@hyperic.net, All Rights Reserved.