spo.src.SPDB.dbAdapter
Class AbstractDatabase

java.lang.Object
  |
  +--spo.src.SPDB.dbAdapter.AbstractDatabase
Direct Known Subclasses:
MySQLAdapter, OracleAdapter

public abstract class AbstractDatabase
extends java.lang.Object

An abstract class that encapsulates access to any RDBMS. This allows to swap easily between databases without any modification to the application. Any vendor specific variable or function is encapsulated here. Thus this class offers extended programming interface that all subclasses should implement to gain access to different databases. To add a new database adapter class you must create a new class Adapter that extends dbadapter.AbstarctDatabase (where dbname is the name of the database or database driver you wish to add to your application). AbstarctDatabase is an abstract class, thus the subclasses need to implement the abstract methods.


Constructor Summary
AbstractDatabase()
           
 
Method Summary
static java.lang.Object createObject(java.lang.String className)
          Instantiate a class using the name of the class at runtime
abstract  int createSequence(DBUtil dbutil, java.lang.String tableName)
          Create a sequence
abstract  int dropSequence(DBUtil dbutil, java.lang.String tableName)
          Drop the sequence
abstract  java.lang.String getDateTimeFunction()
          Get the function name that gets the current date and time from the database server
abstract  java.lang.String getIsNULLFunction()
          Get the function name that returns non-NULL value
abstract  java.lang.String getStringDelimiter()
          Get the delimiter that the specific database implementation uses to indicate string literals in SQL.
abstract  int getUniqueID(DBUtil dbutil, java.lang.String tableName)
          Unique ID generator
abstract  int getUniqueRID(DBUtil dbutil, java.lang.String tableName)
           
static void main(java.lang.String[] args)
          the main routine used to test the dbadapter utility.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractDatabase

public AbstractDatabase()
Method Detail

createSequence

public abstract int createSequence(DBUtil dbutil,
                                   java.lang.String tableName)
                            throws java.sql.SQLException
Create a sequence

Parameters:
tableName - name of the table
java.sql.SQLException

dropSequence

public abstract int dropSequence(DBUtil dbutil,
                                 java.lang.String tableName)
                          throws java.sql.SQLException
Drop the sequence

Parameters:
tableName - name of the table
java.sql.SQLException

getUniqueRID

public abstract int getUniqueRID(DBUtil dbutil,
                                 java.lang.String tableName)
                          throws java.sql.SQLException
java.sql.SQLException

getUniqueID

public abstract int getUniqueID(DBUtil dbutil,
                                java.lang.String tableName)
                         throws java.sql.SQLException
Unique ID generator

Parameters:
tableName - name of the table
java.sql.SQLException

getDateTimeFunction

public abstract java.lang.String getDateTimeFunction()
Get the function name that gets the current date and time from the database server


getIsNULLFunction

public abstract java.lang.String getIsNULLFunction()
Get the function name that returns non-NULL value


getStringDelimiter

public abstract java.lang.String getStringDelimiter()
Get the delimiter that the specific database implementation uses to indicate string literals in SQL. This will usually be a single qoute (').

Returns:
return the string delimiter

createObject

public static java.lang.Object createObject(java.lang.String className)
                                     throws java.lang.Exception
Instantiate a class using the name of the class at runtime

Parameters:
className - the name of the class
java.lang.Exception

main

public static void main(java.lang.String[] args)
the main routine used to test the dbadapter utility.



Copyright © 2003 UKCS. All Rights Reserved.