Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

info.crossbar.util.db
Class DbUtils  view DbUtils download DbUtils.java

java.lang.Object
  extended byinfo.crossbar.util.db.DbUtils

public class DbUtils
extends java.lang.Object

DbUtils class for use by Crossbar

Version:
View source, revision history $Revision: 1.2 $ $Date: 2003/06/04 04:55:32 $

DESCRIPTION: This class is a database access object or a "doorway" to a database. This class does not decouple or isolate the database schema from the web application. Objects that use the DbUtils object to interact with the database need to know about the database's tables. Consequently, this DbUtils object is useful for manipulation of database tables that are tightly coupled to the application, such as tables that define the structure of the application. If you are building an application that should be decoupled from possible changes to an underlying database schema, you should not use this object to access the database. You should build Models that interact with business data through EJB or another object-relational mapping technology.


Field Summary
private static java.util.logging.Logger log
          Set up logging.
 
Constructor Summary
DbUtils()
          Constructor.
 
Method Summary
static void createTable(java.lang.String sourcename, java.lang.String tablename, java.lang.String statement)
          Establish a new data table.
static java.sql.ResultSet execQuery(java.sql.Statement stmt, java.lang.String query)
          Convenience method creates an SQL statement and executes a query.
static boolean execUpdate(java.sql.Connection conn, java.lang.String update)
          Convenience method executes an update of a database.
static java.lang.String getFieldValue(java.lang.String sourcename, java.lang.String tablename, java.lang.String column, java.lang.String where)
          Do a simple database lookup, returning a single string, specifying a datasource, table, column, and "where clause."
static void populateTable(java.lang.String sourcename, java.lang.String tablename, java.util.Map collection)
          Adds data obtained from a Map object to a specified data table.
static boolean tableExists(java.lang.String sourcename, java.lang.String tablename)
          Tests if a data table exists
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static java.util.logging.Logger log
Set up logging.

Constructor Detail

DbUtils

public DbUtils()
        throws javax.servlet.ServletException
Constructor.

Method Detail

execQuery

public static java.sql.ResultSet execQuery(java.sql.Statement stmt,
                                           java.lang.String query)
                                    throws java.sql.SQLException
Convenience method creates an SQL statement and executes a query.


execUpdate

public static boolean execUpdate(java.sql.Connection conn,
                                 java.lang.String update)
                          throws java.sql.SQLException
Convenience method executes an update of a database.


tableExists

public static boolean tableExists(java.lang.String sourcename,
                                  java.lang.String tablename)
                           throws javax.servlet.ServletException
Tests if a data table exists


createTable

public static void createTable(java.lang.String sourcename,
                               java.lang.String tablename,
                               java.lang.String statement)
                        throws javax.servlet.ServletException
Establish a new data table. This method can be called by an object after testing and determining a table is missing.


populateTable

public static void populateTable(java.lang.String sourcename,
                                 java.lang.String tablename,
                                 java.util.Map collection)
                          throws javax.servlet.ServletException
Adds data obtained from a Map object to a specified data table.


getFieldValue

public static java.lang.String getFieldValue(java.lang.String sourcename,
                                             java.lang.String tablename,
                                             java.lang.String column,
                                             java.lang.String where)
                                      throws javax.servlet.ServletException
Do a simple database lookup, returning a single string, specifying a datasource, table, column, and "where clause."