org.web_auth.utils
Class DbUtils

java.lang.Object
  extended byorg.web_auth.utils.DbUtils

public class DbUtils
extends java.lang.Object

Utility class facilitates database related operations.

Version:
1.0
Author:
Zhengrong Tang

Field Summary
static java.lang.String DATA_SOURCE_CONFIG_DATA_SOURCE_TYPE
           
static java.lang.String DATA_SOURCE_CONFIG_PASSWORD
           
static java.lang.String DATA_SOURCE_CONFIG_URL
           
static java.lang.String DATA_SOURCE_CONFIG_USERNAME
           
static java.lang.String DATA_SOURCE_TYPE_MYSQL
           
static java.lang.String DATA_SOURCE_TYPE_ORACLE
           
 
Constructor Summary
DbUtils()
           
 
Method Summary
static java.sql.Connection GetConnection()
          Returns a Connection object for the default data source.
static java.sql.Connection GetConnection(javax.servlet.http.HttpServletRequest request)
          Returns a Connection object for the default data source and the given http servlet request.
static java.sql.Connection GetConnection(javax.servlet.http.HttpServletRequest request, java.lang.String dataSourceName)
          Returns a Connection object for a given data source and the given http servlet request.
static java.sql.Connection GetConnection(java.lang.String dataSourceName)
          Returns a Connection object for a given data source.
static java.sql.Timestamp Now()
          A convenient method that returns a date object representing the current date and time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATA_SOURCE_TYPE_MYSQL

public static final java.lang.String DATA_SOURCE_TYPE_MYSQL
See Also:
Constant Field Values

DATA_SOURCE_TYPE_ORACLE

public static final java.lang.String DATA_SOURCE_TYPE_ORACLE
See Also:
Constant Field Values

DATA_SOURCE_CONFIG_DATA_SOURCE_TYPE

public static final java.lang.String DATA_SOURCE_CONFIG_DATA_SOURCE_TYPE
See Also:
Constant Field Values

DATA_SOURCE_CONFIG_URL

public static final java.lang.String DATA_SOURCE_CONFIG_URL
See Also:
Constant Field Values

DATA_SOURCE_CONFIG_USERNAME

public static final java.lang.String DATA_SOURCE_CONFIG_USERNAME
See Also:
Constant Field Values

DATA_SOURCE_CONFIG_PASSWORD

public static final java.lang.String DATA_SOURCE_CONFIG_PASSWORD
See Also:
Constant Field Values
Constructor Detail

DbUtils

public DbUtils()
Method Detail

GetConnection

public static java.sql.Connection GetConnection()
Returns a Connection object for the default data source.

Returns:
A java.sql.Connection object.

GetConnection

public static java.sql.Connection GetConnection(java.lang.String dataSourceName)
Returns a Connection object for a given data source.

Parameters:
dataSourceName - The name of a data source.
Returns:
A java.sql.Connection object.

GetConnection

public static java.sql.Connection GetConnection(javax.servlet.http.HttpServletRequest request)
Returns a Connection object for the default data source and the given http servlet request. Currently, this method does not use the http servlet request. It will be used in feature version.

Parameters:
request - an HttpServletRequest object
Returns:
A java.sql.Connection object.

GetConnection

public static java.sql.Connection GetConnection(javax.servlet.http.HttpServletRequest request,
                                                java.lang.String dataSourceName)
Returns a Connection object for a given data source and the given http servlet request. Currently, this method does not use the http servlet request. It will be used in feature version.

Parameters:
request - an HttpServletRequest object
dataSourceName - The name of a data source.
Returns:
A java.sql.Connection object.

Now

public static java.sql.Timestamp Now()
A convenient method that returns a date object representing the current date and time.

Returns:
a timestamp object representing the current date and time


Copyright © 2003 Zhengrong Tang. All Rights Reserved.