org.apache.geronimo.console.internaldb
Class DerbyConnectionUtil

java.lang.Object
  extended by org.apache.geronimo.console.internaldb.DerbyConnectionUtil

public class DerbyConnectionUtil
extends Object

A static class to handle retreiving connections. This class is built to handle lookups to the SystemDatabase as a special case. If a connection is requested for the SystemDatabase this class gets a DataSource from an admin object registered in the geronimo kernel otherwise the DataSource is looked up via JNDI.


Field Summary
static String CREATE_DB_PROP
           
static String SHUTDOWN_DB_PROP
           
 
Constructor Summary
DerbyConnectionUtil()
           
 
Method Summary
static DataSource getDataSource(String dbName)
          Get the datasource if dbName is == SYSTEM_DB, otherwise returns null.
static Connection getDerbyConnection(String dbName)
           
static Connection getDerbyConnection(String dbName, String properties)
          Get a connection to derby.
static String getDerbyHome()
          Get the Derby home directory path.
static Connection getSystemDBConnection()
          Get a connection to the SystemDatabase.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CREATE_DB_PROP

public static final String CREATE_DB_PROP
See Also:
Constant Field Values

SHUTDOWN_DB_PROP

public static final String SHUTDOWN_DB_PROP
See Also:
Constant Field Values
Constructor Detail

DerbyConnectionUtil

public DerbyConnectionUtil()
Method Detail

getDerbyHome

public static String getDerbyHome()
Get the Derby home directory path.


getDerbyConnection

public static Connection getDerbyConnection(String dbName,
                                            String properties)
                                     throws SQLException
Get a connection to derby.

Parameters:
dbName - the name of the database to connect to.
properties - the properties to pass to the connection string.
Returns:
connection
Throws:
SQLException

getDerbyConnection

public static Connection getDerbyConnection(String dbName)
                                     throws SQLException
Throws:
SQLException

getSystemDBConnection

public static Connection getSystemDBConnection()
                                        throws SQLException
Get a connection to the SystemDatabase.

Returns:
Throws:
SQLException

getDataSource

public static DataSource getDataSource(String dbName)
Get the datasource if dbName is == SYSTEM_DB, otherwise returns null.

Parameters:
dbName -
Returns:
datasource


Copyright © 2003-2007 Apache Software Foundation. All Rights Reserved.