Overview | Package | Class | Tree | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.mdm.index.util
Class ConnectionUtil

    java.lang.Object
      com.sun.mdm.index.util.ConnectionUtil

public class ConnectionUtil
extends java.lang.Object

Field Summary
`static int` | `DB_AXION`
`static int` | `DB_MYSQL`
`static int` | `DB_ORACLE`
`static int` | `DB_SQLSERVER`
`static int` | `DB_UNKNOWN`

Constructor Summary
`ConnectionUtil()`

Method Summary
`static java.sql.Connection` | `getConnection()` Obtains a connection to the database.
`static int` | `getDBProductID()` Get The ID of the database vendor.
`static int` | `getDBProductID(java.sql.Connection con)` Return DBProductID.
`static void` | `initDBProductID(java.sql.Connection con)` Sets up DBProductID for this installation to either DB_SQLSERVER, DB_MYSQL or DB_ORACLE.
`static java.lang.String` | `pingDatabase()` Checks if a database can be reached.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DB_AXION

    public static final int DB_AXION

See Also:
  Constant Field Values

### DB_MYSQL

    public static final int DB_MYSQL

See Also:
  Constant Field Values

### DB_ORACLE

    public static final int DB_ORACLE

See Also:
  Constant Field Values

### DB_SQLSERVER

    public static final int DB_SQLSERVER

See Also:
  Constant Field Values

### DB_UNKNOWN

    public static final int DB_UNKNOWN

See Also:
  Constant Field Values

Constructor Detail

### ConnectionUtil

    public ConnectionUtil()

Method Detail

### getConnection

    public static java.sql.Connection getConnection()
                                             throws java.lang.Exception

  Obtains a connection to the database.

  Returns:
    Connection to the database.
  Throws:
    `java.lang.Exception` - if an error occurs.

### getDBProductID

    public static int getDBProductID()

  Get The ID of the database vendor.

  Returns:
    DB_SQLSERVER for an SQL Server database or DB_ORACLE for an Oracle database or DB_MYSQL for a MySQL database or DB_AXION for an Axion database

### getDBProductID

    public static int getDBProductID(java.sql.Connection con)
                              throws java.lang.Exception

  Return DBProductID.

  Parameters:
    `con` - Database connection.
  Returns:
    DB_SQLSERVER for an SQL Server database or DB_ORACLE for an Oracle database or DB_MYSQL for a MySQL database or DB_AXION for an Axion database
  Throws:
    `java.lang.Exception` - if an error occurred.

### initDBProductID

    public static void initDBProductID(java.sql.Connection con)
                                throws java.lang.Exception

  Sets up DBProductID for this installation to either DB_SQLSERVER, DB_MYSQL or DB_ORACLE.

  Parameters:
    `con` - Database connection.
  Throws:
    `java.lang.Exception` - if an error is encountered.

### pingDatabase

    public static java.lang.String pingDatabase()

  Checks if a database can be reached.

  Returns:
    String indicating the status of the database.

Overview | Package | Class | Tree | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Sun Microsystems, Inc.