com.darwinsys.sql
Class ConnectionUtil

java.lang.Object
  extended bycom.darwinsys.sql.ConnectionUtil

public class ConnectionUtil
extends java.lang.Object

Encapsulate the Connection-related operations that every JDBC program seems to use.


Field Summary
static java.lang.String DEFAULT_NAME
          The default config filename, relative to ${user.home}
 
Constructor Summary
ConnectionUtil()
           
 
Method Summary
static java.sql.Connection createConnection(java.lang.String db_driver, java.lang.String db_url, java.lang.String db_user, java.lang.String db_password)
           
static java.lang.String getConfigFileName()
          Returns the full path of the configuration file being used.
static java.sql.Connection getConnection(java.util.Properties p, java.lang.String config)
          Get a Connection for the given config name from a provided Properties
static java.sql.Connection getConnection(java.lang.String config)
          Get a Connection for the given config using the default or set property file name
static void setConfigFileName(java.lang.String configFileNam)
          Sets the full path of the config file to read.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_NAME

public static final java.lang.String DEFAULT_NAME
The default config filename, relative to ${user.home}

See Also:
Constant Field Values
Constructor Detail

ConnectionUtil

public ConnectionUtil()
Method Detail

getConnection

public static java.sql.Connection getConnection(java.lang.String config)
                                         throws DataBaseException
Get a Connection for the given config using the default or set property file name

Throws:
DataBaseException

getConnection

public static java.sql.Connection getConnection(java.util.Properties p,
                                                java.lang.String config)
                                         throws DataBaseException
Get a Connection for the given config name from a provided Properties

Throws:
DataBaseException

createConnection

public static java.sql.Connection createConnection(java.lang.String db_driver,
                                                   java.lang.String db_url,
                                                   java.lang.String db_user,
                                                   java.lang.String db_password)
                                            throws java.lang.ClassNotFoundException,
                                                   java.sql.SQLException
Throws:
java.lang.ClassNotFoundException
java.sql.SQLException

getConfigFileName

public static java.lang.String getConfigFileName()
Returns the full path of the configuration file being used.

Returns:
Returns the configFileName.

setConfigFileName

public static void setConfigFileName(java.lang.String configFileNam)
Sets the full path of the config file to read.

Parameters:
configFileNam - The FileName of the configuration file to use.


Copyright © 2000-2003 Ian F. Darwin. See license.html for usage license.