IBM Branch Transformation Toolkit Javadoc

com.ibm.btt.services.jdbctableservice
Class JDBCTableService

java.lang.Object
  extended bycom.ibm.btt.base.Service
      extended bycom.ibm.btt.services.BTTServiceRequester
          extended bycom.ibm.btt.services.PooledServiceRequester
              extended bycom.ibm.btt.services.jdbcservicesinfra.JDBCService
                  extended bycom.ibm.btt.services.jdbctableservice.JDBCTableService
All Implemented Interfaces:
DatabaseConnect, Externalizable, java.io.Externalizable, java.io.Serializable, TableService

public class JDBCTableService
extends JDBCService
implements TableService

The JDBCTable class provides the interface to access any database table. It can use, as the underlying data store, any DBMS that implements the JDBC protocol.

See Also:
Serialized Form

Field Summary
protected  boolean autoConnect
          Keeps the connection criteria that the JDBCTable service must follow.
protected  java.lang.String catalog
          The name of database catalog where the table is created.
protected  Hashtable columnsTable
          Contains information about the relationship between a column in the database table and a data field in the context.
static java.lang.String COMPID
          Keeps the component identification that will be used by the traces tool.
protected  java.lang.String JDBCDriver
          Keeps the name of the JDBC driver to be used to access the database.
protected  boolean primaryKeys
          Keeps whether the service must prevent the application from modify a primary key when updating a record (the service will automatically remove any column set in the update statement that is a primary key for the table) or the application itself will take care of this issue and then the service will throw an exception if the application tries to update a primary key.
protected  Hashtable primaryKeysHashtable
          Keeps the table primary keys for all the tables being accessed using a JDBCTable instance.
protected  java.lang.String schema
          The name of database schema where the table is created.
protected  java.lang.String tableName
          The name of the table the JDBCTable service will work with.
protected static Hashtable tablesMetaData
          Keeps the table meta data information for all the tables being accessed using a JDBCTable instance.
 
Fields inherited from class com.ibm.btt.services.jdbcservicesinfra.JDBCService
addPstmt, addString, autoCommit, connectionProperties, databaseConnection, databaseURL, dataSourceName, metaData, password, poolName, sharedConnection, STMT_POOL_SIZE_DEFAULT, stmtPool, stmtPoolSize, updateString, user, waitRetry
 
Fields inherited from class com.ibm.btt.services.PooledServiceRequester
poolable, poolId
 
Fields inherited from class com.ibm.btt.base.Service
externalizer, name
 
Constructor Summary
JDBCTableService()
          This constructor creates a JDBCTable object.
 
Method Summary
 void addRecord(Context aContext, FormatElement aHashtableFormat)
          Calls the format method of the hashtable formatter aHashtableFormat by passing the aContext context as an argument.
 void addRecord(Context aContext, FormatElement aHashtableFormat, Vector aColumnsVector)
          Calls the format method of the hashtable formatter aHashtableFormat by passing the aContext context as an argument.
 void addRecord(Context aContext, java.lang.String aFormatName)
          Instantiates the table format named aFormatName and calls its format method by passing the aContext as an argument.
 void addRecord(Context aContext, java.lang.String aFormatName, Vector aColumnsVector)
          Instantiates the table format named aFormatName and calls its format method by passing the aContext context as an argument.
 void addRecord(Hashtable aDataHashtable)
          Inserts the data from aDataHashtable as a new row into the table assigned to the table service.
 void addRecord(Hashtable aDataHashtable, Vector aColumnsVector)
          Inserts a record in the database only passing values to the columns specified in aColumnsVector.
 void commit()
          Commits all changes to the database.
 void connect(java.lang.String aUser, java.lang.String aPassword)
          Connects to the Database set in the DataSource definition using aUser and aPassword.
 void deleteRecordsMatching(java.lang.String aSearchCondition)
          Deletes the records in the table that match the search criteria.
 void disconnect()
          Closes the database connection.
 void executeProcedure(java.lang.String procedureName, Context aContext, FormatElement aHashtableInputFormat)
          Builds a data Hashtable by calling the format method of the aHashtableInputFormat with the aContext as an argument.
 void executeProcedure(java.lang.String procedureName, Context aContext, FormatElement aHashtableInputFormat, FormatElement aHashtableOutputFormat)
          Builds a data Hashtable by calling the format method of the aHashtableFormat with the aContext as an argument.
 void executeProcedure(java.lang.String procedureName, Context aContext, FormatElement aHashtableInputFormat, java.lang.String aHashtableOutputFormatName)
          Builds a data Hashtable by calling the format method of the aHashtableFormat with the aContext as an argument.
 void executeProcedure(java.lang.String procedureName, Context aContext, Hashtable dataHashtable, FormatElement aHashtableOutputFormat)
          Executes the stored procedure procedureName with the parameters given in the dataHashtable.
 void executeProcedure(java.lang.String procedureName, Context aContext, Hashtable dataHashtable, java.lang.String aHashtableOutputFormatName)
          Executes the stored procedureName with the parameters given in the dataHashtable.
 void executeProcedure(java.lang.String procedureName, Context aContext, java.lang.String aHashtableInputFormatName)
          Instantiates the HashtableFormat defined as aHashtableInputFormatName and passes it as an argument to the method executeProcedure(String, Context, HashtableFormat).
 void executeProcedure(java.lang.String procedureName, Context aContext, java.lang.String aHashtableInputFormatName, java.lang.String aHashtableOutputFormatName)
          Instantiates the HashtableFormat defined as aHashtableInputFormatName and passes it as an argument to the executeProcedure(String, Context, HashtableFormat, String) method.
 void executeProcedure(java.lang.String procedureName, Hashtable dataHashtable)
          Pass the s procedureName with the parameters given in the dataHashtable to execute storedproecdure in service object
 Hashtable executeProcedureWithReply(java.lang.String procedureName, Hashtable dataHashtable)
          Pass the stored procedureName with the parameters given in the dataHashtable.
 void executeSQLQuery(java.lang.String anSQLStatement, java.lang.String outputFormatName, Context aContext)
          Executes an SQL statement that returns a single ResultSet and unformats it into aContext using the outputFormatName.
 int executeSQLUpdate(java.lang.String anSQLStatement)
          Executes an SQL INSERT, UPDATE ,DELETE statement, or an SQL statement that returns nothing.
 boolean getAutoConnect()
          Returns the autoConnect attribute value.
 java.lang.String getCatalogName()
          Returns the catalog attribute value.
 Hashtable getColumnsTable()
          Returns the columnsTable attribute value.
 java.lang.String getFullProcedureName(java.lang.String procedureName)
          Builds and returns the full name for the Stored Procedure, adding the schema name if it is set.
 java.lang.String getFullTableName()
          Builds and returns the full table name, adding the schema name if it is set.
 java.lang.String getSchemaName()
          Returns the schema attribute value.
 java.lang.String getTableName()
          Returns the tableName attribute value.
 void initialize()
          Performs any required actions after service instanciation and before starting using it.
 boolean isConnected()
          Returns true if there is a connection to the database or false if there is not.
 boolean isPrimaryKeys()
          Returns the primaryKeys attribute value.
 Vector retrieveRecordsMatching(java.lang.String aSearchCondition)
          Retrieves all the records within the database table that match the search condition.
 void retrieveRecordsMatching(java.lang.String aSearchCondition, Context aContext, FormatElement anOutputFormat)
          Retrieves all the records within the database table that match the search condition.
 void retrieveRecordsMatching(java.lang.String aSearchCondition, Context aContext, java.lang.String anOutputFormatName)
          Retrieves all the records within the database table that match the search condition.
 Vector retrieveRecordsMatching(java.lang.String aSearchCondition, Vector aColumnsVector)
          Retrieves the columns in aColumnsVector of all the records within the database table that match the search condition.
 void retrieveRecordsMatching(java.lang.String aSearchCondition, Vector aColumnsVector, Context aContext, FormatElement anOutputFormat)
          Retrieves the columns in aColumnsVector of all the records within the database table that match the search condition.
 void retrieveRecordsMatching(java.lang.String aSearchCondition, Vector aColumnsVector, Context aContext, java.lang.String anOutputFormatName)
          Retrieves the columns in aColumnsVector of all the records within the database table that match the search condition.
 void rollback()
          Rolls back all the database changes if the autoCommit attribute is set to false.
 void setAutoConnect(boolean b)
          Sets the autoConnect attribute to a boolean.
 void setCatalogName(java.lang.String s)
          Sets the catalog attribute to the string provided as argument.
 void setPrimaryKeys(boolean newPrimaryKeys)
          Sets the primaryKeys attribute value to newPrimaryKeys.
 void setSchemaName(java.lang.String s)
          Sets the schema attribute to the string provided as an argument.
 void setTableName(java.lang.String s)
          Sets the tableName attribute to the string provided as an argument.
 int updateRecordsMatching(java.lang.String aSearchCondition, Context aContext, FormatElement aHashtableFormat)
          Updates all of the table records that match the search condition with the result from formatting the context data using the aHashtableFormat.
 int updateRecordsMatching(java.lang.String aSearchCondition, Context aContext, FormatElement aHashtableFormat, Vector aColumnsVector)
          Updates the columns specified in aColumnsVector for the records that match the search condition with the data provided in the operation context.
 int updateRecordsMatching(java.lang.String aSearchCondition, Context aContext, java.lang.String aFormatName)
          Updates all the table records that match the search condition with the result from formatting the context data using the formatter defined as aFormatName.
 int updateRecordsMatching(java.lang.String aSearchCondition, Context aContext, java.lang.String aFormatName, Vector aColumnsVector)
          Updates the columns specified in aColumnsVector for the records that match the search condition with the data provided in the operation context.
 int updateRecordsMatching(java.lang.String aSearchCondition, Hashtable aDataHashtable)
          Updates all the table records that match the search condition with the Hashtable data.
 int updateRecordsMatching(java.lang.String aSearchCondition, Hashtable aDataHashtable, Vector aColumnsVector)
          Updates the columns specified in aColumnsVector for all the records which match the search condition with the data provided in aDataHashtable.
 
Methods inherited from class com.ibm.btt.services.jdbcservicesinfra.JDBCService
connect, getAutoCommit, getDataSourceName, getPassword, getUser, isWaitRetry, setAutoCommit, setDataSourceName, setPassword, setUser, setWaitRetry, verifyConnection
 
Methods inherited from class com.ibm.btt.services.PooledServiceRequester
getGrantTime, getPoolable, getPoolable, getPoolId, getServiceID, grantServiceID, initializeFrom, initializeFrom, processRequest, releaseOrphan, releaseOrphan, releasePoolable, releaseServiceRequester, setGrantTime, setPoolId
 
Methods inherited from class com.ibm.btt.services.BTTServiceRequester
getCachingEnabled, getInactiveTimeout, getLastAccess, getServiceInvocation, getServiceType, HashMapToHashtable, newInstance, setCachingEnabled, setInactiveTimeout, setLastAccess, setServiceID, setServiceInvocation, setServiceType
 
Methods inherited from class com.ibm.btt.base.Service
externalizer, getExternalizer, getName, getTagName, readExternal, readExternal, readObject, removeExternal, setExternalizer, setName, terminate, toString, toStrings, toTags, writeExternal, writeExternal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.ibm.btt.services.jdbctableservice.TableService
getAutoCommit, getPassword, getUser, setAutoCommit, setPassword, setUser
 
Methods inherited from interface com.ibm.btt.services.jdbcservicesinfra.DatabaseConnect
getDataSourceName, isWaitRetry, setDataSourceName, setWaitRetry
 

Field Detail

COMPID

public static final java.lang.String COMPID
Keeps the component identification that will be used by the traces tool.

See Also:
Constant Field Values

autoConnect

protected boolean autoConnect
Keeps the connection criteria that the JDBCTable service must follow. If it is set to true, the service will take care of managing the connection to the database.


tableName

protected java.lang.String tableName
The name of the table the JDBCTable service will work with.


schema

protected java.lang.String schema
The name of database schema where the table is created. It is used to get the database table primary keys.


primaryKeys

protected boolean primaryKeys
Keeps whether the service must prevent the application from modify a primary key when updating a record (the service will automatically remove any column set in the update statement that is a primary key for the table) or the application itself will take care of this issue and then the service will throw an exception if the application tries to update a primary key. The first one is the default behavior and requires the getPrimaryKeys() method to be implemented by the JDBC driver being used.


catalog

protected java.lang.String catalog
The name of database catalog where the table is created. It is used to get the database table primary keys.


columnsTable

protected Hashtable columnsTable
Contains information about the relationship between a column in the database table and a data field in the context. Has the following structure: key = column_name, value = data_field_name.


JDBCDriver

protected java.lang.String JDBCDriver
Keeps the name of the JDBC driver to be used to access the database.


primaryKeysHashtable

protected Hashtable primaryKeysHashtable
Keeps the table primary keys for all the tables being accessed using a JDBCTable instance. The key is the full table name and the value is a Vector with the names of the table columns that are primary keys.


tablesMetaData

protected static Hashtable tablesMetaData
Keeps the table meta data information for all the tables being accessed using a JDBCTable instance. The key is the full table name and the value is an instance of the DatabaseResultSetMetaData class.

Constructor Detail

JDBCTableService

public JDBCTableService()
This constructor creates a JDBCTable object.

Method Detail

addRecord

public void addRecord(Context aContext,
                      FormatElement aHashtableFormat)
               throws DSEInvalidArgumentException,
                      DSEInvalidRequestException,
                      DSEInternalErrorException,
                      DSESQLException,
                      DSEException,
                      DSEInvalidClassException,
                      java.lang.Exception
Calls the format method of the hashtable formatter aHashtableFormat by passing the aContext context as an argument. The returned object, a Hashtable instance, is then used to build the table record by calling the addRecord(Hashtable) method.

Specified by:
addRecord in interface TableService
Parameters:
aContext - Context
aHashtableFormat - HashtableFormat - the table formatter
Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInvalidRequestException - if the request is not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSEException - if an exception is thrown when calling the pool of connections
DSEInvalidClassException - if there is an error in the formatting process
java.lang.Exception

addRecord

public void addRecord(Context aContext,
                      FormatElement aHashtableFormat,
                      Vector aColumnsVector)
               throws DSEInvalidArgumentException,
                      DSEInvalidRequestException,
                      DSEInternalErrorException,
                      DSESQLException,
                      DSEException,
                      DSEInvalidClassException,
                      java.lang.Exception
Calls the format method of the hashtable formatter aHashtableFormat by passing the aContext context as an argument. The returned object, a Hashtable instance, is then used to build the table record by calling the addRecord(Hashtable, Vector) method. The aColumnsVector argument contains the columns that will be added for the new record in the database; the formatter definition must only contain the reference to these columns.

Specified by:
addRecord in interface TableService
Parameters:
aContext - Context
aHashtableFormat - HashtableFormat - the table formatter
aColumnsVector - Vector - the vector that contains the columns to be added
Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInvalidRequestException - if the request is not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSEException - if an exception is thrown when calling the pool of connections
DSEInvalidClassException - if there is an error in the formatting process
java.lang.Exception

addRecord

public void addRecord(Context aContext,
                      java.lang.String aFormatName)
               throws DSEInvalidArgumentException,
                      DSEInvalidRequestException,
                      DSEInternalErrorException,
                      DSESQLException,
                      DSEException,
                      DSEInvalidClassException,
                      java.io.IOException,
                      java.lang.Exception
Instantiates the table format named aFormatName and calls its format method by passing the aContext as an argument. The returned object, a Hashtable instance, is then used to build the table record by calling the addRecord(Hashtable) method.

Specified by:
addRecord in interface TableService
Parameters:
aContext - Context
aFormatName - java.lang.String - the table formatter name
Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInvalidRequestException - if the request is not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSEException - if an exception is thrown when calling the pool of connections
DSEInvalidClassException - if there is an error in the formatting process
java.io.IOException - if there is an error instanciating the formatter from its external definition
java.lang.Exception

addRecord

public void addRecord(Context aContext,
                      java.lang.String aFormatName,
                      Vector aColumnsVector)
               throws DSEInvalidArgumentException,
                      DSEInvalidRequestException,
                      DSEInternalErrorException,
                      DSESQLException,
                      DSEException,
                      DSEInvalidClassException,
                      java.io.IOException,
                      java.lang.Exception
Instantiates the table format named aFormatName and calls its format method by passing the aContext context as an argument. The returned object, a Hashtable instance, is then used to build the table record by calling the addRecord(Hashtable, Vector) method. The aColumnsVector argument contains the columns that will be added for the new record in the database; the formatter definition must only contain the reference to these columns.

Specified by:
addRecord in interface TableService
Parameters:
aContext - Context
aFormatName - java.lang.String - the table formatter name
aColumnsVector - Vector - the vector that contains the columns to be added
Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInvalidRequestException - if the request is not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSEException - if an exception is thrown when calling the pool of connections
DSEInvalidClassException - if there is an error in the formatting process
java.io.IOException - if there is an error instanciating the formatter from its external definition
java.lang.Exception

addRecord

public void addRecord(Hashtable aDataHashtable)
               throws DSEInvalidRequestException,
                      DSEInvalidArgumentException,
                      DSEInternalErrorException,
                      DSESQLException,
                      DSEException,
                      java.lang.Exception
Inserts the data from aDataHashtable as a new row into the table assigned to the table service. The data hashtable has the following format: key=data_field_name, value=data_field_value

Specified by:
addRecord in interface TableService
Parameters:
aDataHashtable - Hashtable
Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInvalidRequestException - if the request is not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSEException - if an exception is thrown when calling the pool of connections
java.lang.Exception

addRecord

public void addRecord(Hashtable aDataHashtable,
                      Vector aColumnsVector)
               throws DSEInvalidArgumentException,
                      DSEInternalErrorException,
                      DSEInvalidRequestException,
                      DSESQLException,
                      DSEException,
                      java.lang.Exception
Inserts a record in the database only passing values to the columns specified in aColumnsVector. The aDataHashtable must contain only the data field values of the columns that have to be added to the database.

Specified by:
addRecord in interface TableService
Parameters:
aDataHashtable - Hashtable - the Hashtable that contains the data
aColumnsVector - Vector - the vector that contains the columns to be added
Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSEInvalidRequestException - if the request is not valid
DSESQLException - if an SQLException is caught
DSEException - if an exception is thrown when calling the pool of connections
java.lang.Exception

commit

public void commit()
            throws DSESQLException,
                   java.lang.Exception
Commits all changes to the database. Nothing is done if the autoCommit attribute is set to true.

Specified by:
commit in interface TableService
Throws:
DSESQLException - if commit fails
java.lang.Exception

connect

public void connect(java.lang.String aUser,
                    java.lang.String aPassword)
             throws DSEInternalErrorException,
                    DSEInvalidRequestException,
                    DSESQLException,
                    DSEObjectNotFoundException,
                    DSEException
Connects to the Database set in the DataSource definition using aUser and aPassword. This method can only be used if the connection is requested using a pool of connections implemented as a DataSource with the database URL specified as part of the DataSource definition.

Specified by:
connect in interface DatabaseConnect
Overrides:
connect in class JDBCService
Parameters:
aUser - java.lang.String - the user identification
aPassword - java.lang.String - the user password
Throws:
DSEInvalidRequestException - if the request is not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSEObjectNotFoundException - if the JDBCServicesConnectionManager cannot be found
DSEException - if an exception is thrown when calling the pool of connections manager

deleteRecordsMatching

public void deleteRecordsMatching(java.lang.String aSearchCondition)
                           throws DSEInvalidArgumentException,
                                  DSEInvalidRequestException,
                                  DSEInternalErrorException,
                                  DSESQLException,
                                  DSEException,
                                  java.lang.Exception
Deletes the records in the table that match the search criteria.

Specified by:
deleteRecordsMatching in interface TableService
Parameters:
aSearchCondition - java.lang.String - the search criteria in SQL format
Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInvalidRequestException - if the request is not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSEException - if an exception is thrown when calling the pool of connections
java.lang.Exception

disconnect

public void disconnect()
                throws DSEInvalidRequestException,
                       DSESQLException,
                       DSEException
Closes the database connection.

Specified by:
disconnect in interface DatabaseConnect
Overrides:
disconnect in class JDBCService
Throws:
DSESQLException - if a SQLException occurs
DSEException - if an exception is thrown when calling the pool of connections
DSEInvalidRequestException - if the database connection is null

executeProcedure

public void executeProcedure(java.lang.String procedureName,
                             Context aContext,
                             Hashtable dataHashtable,
                             FormatElement aHashtableOutputFormat)
                      throws DSEInvalidArgumentException,
                             DSEInvalidRequestException,
                             DSESQLException,
                             DSEInternalErrorException,
                             DSEException,
                             java.io.IOException
Executes the stored procedure procedureName with the parameters given in the dataHashtable. The output parameters are unformatted with aHashtableOutputFormat into aContext.

Specified by:
executeProcedure in interface TableService
Parameters:
procedureName - java.lang.String
dataHashtable - Hashtable
aContext - Context
aHashtableOutputFormat - HashtableFormat
Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSEInvalidRequestException - if the request is not valid
DSEException - if an exception is thrown when calling the pool of connections
java.io.IOException

executeProcedure

public void executeProcedure(java.lang.String procedureName,
                             Context aContext,
                             Hashtable dataHashtable,
                             java.lang.String aHashtableOutputFormatName)
                      throws DSEInvalidArgumentException,
                             DSEInvalidRequestException,
                             DSEInternalErrorException,
                             DSESQLException,
                             DSEException,
                             java.io.IOException
Executes the stored procedureName with the parameters given in the dataHashtable. The output parameters are unformatted with aHashtableFormatName into the aContext.

Specified by:
executeProcedure in interface TableService
Parameters:
procedureName - java.lang.String
dataHashtable - Hashtable
aContext - Context
aHashtableOutputFormatName - java.lang.String
Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSEInvalidRequestException - if the request is not valid
DSEException - if an exception is thrown when calling the pool of connections
java.io.IOException - if there is an error instanciating the formatter from its external definition

executeProcedureWithReply

public Hashtable executeProcedureWithReply(java.lang.String procedureName,
                                           Hashtable dataHashtable)
                                    throws DSEInternalErrorException,
                                           DSESQLException,
                                           DSEInvalidArgumentException,
                                           DSEInvalidRequestException,
                                           DSEException,
                                           java.io.IOException
Pass the stored procedureName with the parameters given in the dataHashtable. The output is a Hashtable to outputParameters.

Specified by:
executeProcedureWithReply in interface TableService
Parameters:
procedureName - java.lang.String
dataHashtable - Hashtable
Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSEInvalidRequestException - if the request is not valid
DSEException - if an exception is thrown when calling the pool of connections
java.io.IOException - if there is an error instanciating the formatter from its external definition

executeProcedure

public void executeProcedure(java.lang.String procedureName,
                             Context aContext,
                             FormatElement aHashtableInputFormat)
                      throws DSEInvalidArgumentException,
                             DSEInternalErrorException,
                             DSESQLException,
                             DSEInvalidRequestException,
                             DSEException
Builds a data Hashtable by calling the format method of the aHashtableInputFormat with the aContext as an argument. The returned Hashtable instance is then passed as parameter of the executeProcedure(String, Hashtable) method.

Specified by:
executeProcedure in interface TableService
Parameters:
procedureName - java.lang.String
aContext - Context
aHashtableInputFormat - HashtableFormat
Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSEInvalidRequestException - if the request is not valid
DSEException - if an exception is thrown when calling the pool of connections

executeProcedure

public void executeProcedure(java.lang.String procedureName,
                             Context aContext,
                             FormatElement aHashtableInputFormat,
                             FormatElement aHashtableOutputFormat)
                      throws DSEInvalidArgumentException,
                             DSEInternalErrorException,
                             DSESQLException,
                             DSEInvalidRequestException,
                             DSEException,
                             java.io.IOException
Builds a data Hashtable by calling the format method of the aHashtableFormat with the aContext as an argument. The returned Hashtable is then passed as a parameter of the executeProcedure(String, Context, Hashtable, HashtableFormat) method.

Specified by:
executeProcedure in interface TableService
Parameters:
procedureName - java.lang.String
aContext - Context
aHashtableInputFormat - HashtableFormat
aHashtableOutputFormat - HashtableFormat
Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSEInvalidRequestException - if the request is not valid
DSEException - if an exception is thrown when calling the pool of connections
java.io.IOException

executeProcedure

public void executeProcedure(java.lang.String procedureName,
                             Context aContext,
                             FormatElement aHashtableInputFormat,
                             java.lang.String aHashtableOutputFormatName)
                      throws DSEInvalidArgumentException,
                             DSEInternalErrorException,
                             DSESQLException,
                             DSEInvalidRequestException,
                             DSEException,
                             java.io.IOException
Builds a data Hashtable by calling the format method of the aHashtableFormat with the aContext as an argument. The returned Hashtable is then passed as a parameter of the executeProcedure(String, Context, Hashtable, String) method.

Specified by:
executeProcedure in interface TableService
Parameters:
procedureName - java.lang.String
aContext - Context
aHashtableInputFormat - HashtableFormat
aHashtableOutputFormatName - java.lang.String
Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSEInvalidRequestException - if the request is not valid
DSEException - if an exception is thrown when calling the pool of connections
java.io.IOException - if there is an error instanciating the formatter from its external definition

executeProcedure

public void executeProcedure(java.lang.String procedureName,
                             Context aContext,
                             java.lang.String aHashtableInputFormatName)
                      throws DSEInvalidArgumentException,
                             DSEInternalErrorException,
                             DSESQLException,
                             DSEInvalidRequestException,
                             DSEException,
                             java.io.IOException
Instantiates the HashtableFormat defined as aHashtableInputFormatName and passes it as an argument to the method executeProcedure(String, Context, HashtableFormat).

Specified by:
executeProcedure in interface TableService
Parameters:
procedureName - java.lang.String
aContext - Context
aHashtableInputFormatName - java.lang.String
Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQL Exception is caught
DSEInvalidRequestException - if the request is not valid
DSEException - if an exception is thrown when calling the pool of connections
java.io.IOException - if there is an error instanciating the formatter from its external definition

executeProcedure

public void executeProcedure(java.lang.String procedureName,
                             Context aContext,
                             java.lang.String aHashtableInputFormatName,
                             java.lang.String aHashtableOutputFormatName)
                      throws DSEInvalidArgumentException,
                             DSEInternalErrorException,
                             DSESQLException,
                             DSEInvalidRequestException,
                             DSEException,
                             java.io.IOException
Instantiates the HashtableFormat defined as aHashtableInputFormatName and passes it as an argument to the executeProcedure(String, Context, HashtableFormat, String) method.

Specified by:
executeProcedure in interface TableService
Parameters:
procedureName - java.lang.String
aContext - Context
aHashtableInputFormatName - java.lang.String
aHashtableOutputFormatName - java.lang.String
Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSEInvalidRequestException - if the request is not valid
DSEException - if an exception is thrown when calling the pool of connections
java.io.IOException - if there is an error instanciating the formatter from its external definition

executeProcedure

public void executeProcedure(java.lang.String procedureName,
                             Hashtable dataHashtable)
                      throws DSESQLException,
                             DSEInvalidRequestException,
                             DSEInternalErrorException,
                             DSEException
Pass the s procedureName with the parameters given in the dataHashtable to execute storedproecdure in service object

Specified by:
executeProcedure in interface TableService
Parameters:
procedureName - java.lang.String
dataHashtable - Hashtable
Throws:
DSESQLException - if an SQLException is caught
DSEInvalidRequestException - if the request is not valid
DSEInternalErrorException - if an internal program error occurs
DSEException - if an exception is thrown when calling the pool of connections

executeSQLQuery

public void executeSQLQuery(java.lang.String anSQLStatement,
                            java.lang.String outputFormatName,
                            Context aContext)
                     throws DSESQLException,
                            DSEInvalidArgumentException,
                            DSEInvalidRequestException,
                            DSEInternalErrorException,
                            DSEException,
                            DSEObjectNotFoundException,
                            java.io.IOException
Executes an SQL statement that returns a single ResultSet and unformats it into aContext using the outputFormatName.

Specified by:
executeSQLQuery in interface TableService
Parameters:
anSQLStatement - java.lang.String
outputFormatName - java.lang.String
aContext - Context
Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInvalidRequestException - if the request is not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSEException - if an exception is thrown when calling the pool of connections
DSEObjectNotFoundException - if there is an error in the unformatting process
java.io.IOException - if there is an error instanciating the formatter from its external definition

executeSQLUpdate

public int executeSQLUpdate(java.lang.String anSQLStatement)
                     throws DSESQLException,
                            DSEInvalidArgumentException,
                            DSEInvalidRequestException,
                            DSEInternalErrorException,
                            DSEException
Executes an SQL INSERT, UPDATE ,DELETE statement, or an SQL statement that returns nothing. The method returns the row count for INSERT, UPDATE or DELETE or 0 for a SQL statement that returns nothing.

Specified by:
executeSQLUpdate in interface TableService
Parameters:
anSQLStatement - java.lang.String
Returns:
int
Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSEInvalidRequestException - if the request is not valid
DSEException - if an exception is thrown when calling the pool of connections

getAutoConnect

public boolean getAutoConnect()
                       throws DSEException
Returns the autoConnect attribute value.

Specified by:
getAutoConnect in interface TableService
Returns:
boolean
Throws:
DSEException

getCatalogName

public java.lang.String getCatalogName()
                                throws DSEException
Returns the catalog attribute value.

Specified by:
getCatalogName in interface TableService
Returns:
java.lang.String
Throws:
DSEException

getColumnsTable

public Hashtable getColumnsTable()
                          throws DSEException
Returns the columnsTable attribute value.

Returns:
Hashtable
Throws:
DSEException

getFullProcedureName

public java.lang.String getFullProcedureName(java.lang.String procedureName)
                                      throws DSEException
Builds and returns the full name for the Stored Procedure, adding the schema name if it is set.

Returns:
java.lang.String
Throws:
DSEException

getFullTableName

public java.lang.String getFullTableName()
                                  throws DSEException
Builds and returns the full table name, adding the schema name if it is set.

Specified by:
getFullTableName in interface TableService
Returns:
java.lang.String
Throws:
DSEException

getSchemaName

public java.lang.String getSchemaName()
                               throws DSEException
Returns the schema attribute value.

Specified by:
getSchemaName in interface TableService
Returns:
java.lang.String
Throws:
DSEException

getTableName

public java.lang.String getTableName()
                              throws DSEException
Returns the tableName attribute value.

Specified by:
getTableName in interface TableService
Returns:
java.lang.String
Throws:
DSEException

initialize

public void initialize()
                throws DSEException
Performs any required actions after service instanciation and before starting using it.

Throws:
DSEException

isConnected

public boolean isConnected()
                    throws DSEInvalidRequestException,
                           DSEInternalErrorException,
                           DSESQLException,
                           DSEException
Returns true if there is a connection to the database or false if there is not. If the autoConnect attribute has been set to true and the connection to the database does not already exist, it creates its own connection.

Specified by:
isConnected in interface DatabaseConnect
Overrides:
isConnected in class JDBCService
Returns:
boolean
Throws:
DSEInvalidRequestException - if the request is not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSEException - if an exception is thrown when calling the pool of connections

isPrimaryKeys

public boolean isPrimaryKeys()
                      throws DSEException
Returns the primaryKeys attribute value.

Specified by:
isPrimaryKeys in interface TableService
Returns:
boolean
Throws:
DSEException

retrieveRecordsMatching

public Vector retrieveRecordsMatching(java.lang.String aSearchCondition)
                               throws DSEInternalErrorException,
                                      DSEInvalidRequestException,
                                      DSEInvalidArgumentException,
                                      DSESQLException,
                                      DSEException
Retrieves all the records within the database table that match the search condition.

Specified by:
retrieveRecordsMatching in interface TableService
Parameters:
aSearchCondition - java.lang.String - the search condition in SQL format
Returns:
Vector - the vector of hash tables with the retrieved records
Throws:
DSEInvalidRequestException - if the request is not valid
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSEException - if an exception is thrown when calling the pool of connections

retrieveRecordsMatching

public void retrieveRecordsMatching(java.lang.String aSearchCondition,
                                    Context aContext,
                                    FormatElement anOutputFormat)
                             throws DSEInternalErrorException,
                                    DSEInvalidRequestException,
                                    DSEInvalidArgumentException,
                                    DSESQLException,
                                    DSEException,
                                    java.io.IOException
Retrieves all the records within the database table that match the search condition. The retrieved records are then unformatted into the aContext using anOutputFormat.

Specified by:
retrieveRecordsMatching in interface TableService
Parameters:
aSearchCondition - java.lang.String - the search condition in SQL format
aContext - Context - the context to where the retrieved records will be unformatted
anOutputFormat - FormatElement - the formatter to unformat the retrieved records
Throws:
DSEInvalidRequestException - if the request is not valid
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSEException - if an exception is thrown when calling the pool of connections
java.io.IOException - if there is an error instanciating the formatter from its external definition

retrieveRecordsMatching

public void retrieveRecordsMatching(java.lang.String aSearchCondition,
                                    Context aContext,
                                    java.lang.String anOutputFormatName)
                             throws DSEInternalErrorException,
                                    DSEInvalidRequestException,
                                    DSEInvalidArgumentException,
                                    DSESQLException,
                                    DSEException,
                                    java.io.IOException
Retrieves all the records within the database table that match the search condition. The retrieved records are then unformatted into the aContext using the format named anOutputFormatName.

Specified by:
retrieveRecordsMatching in interface TableService
Parameters:
aSearchCondition - java.lang.String - the search condition in SQL format
aContext - Context - the context into which the retrieved records will be unformatted
anOutputFormatName - java.lang.String - the name of the formatter to unformat the retrieved records
Throws:
DSEInvalidRequestException - if the request is not valid
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQL Exception is caught
DSEException - if an exception is thrown when calling the pool of connections
java.io.IOException - if there is an error instanciating the formatter from its external definition

retrieveRecordsMatching

public Vector retrieveRecordsMatching(java.lang.String aSearchCondition,
                                      Vector aColumnsVector)
                               throws DSEInternalErrorException,
                                      DSEInvalidRequestException,
                                      DSEInvalidArgumentException,
                                      DSESQLException,
                                      DSEException
Retrieves the columns in aColumnsVector of all the records within the database table that match the search condition. The format used to put the retrieved data into the operation context must only unformat the returned column values.

Specified by:
retrieveRecordsMatching in interface TableService
Parameters:
aSearchCondition - java.lang.String - the search condition in SQL format
aColumnsVector - Vector - the vector that contains the columns to be retrieved
Returns:
Vector - the vector of Hashtables with the retrieved records
Throws:
DSEInvalidRequestException - if the request is not valid
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSEException - if an exception is thrown when calling the pool of connections

retrieveRecordsMatching

public void retrieveRecordsMatching(java.lang.String aSearchCondition,
                                    Vector aColumnsVector,
                                    Context aContext,
                                    FormatElement anOutputFormat)
                             throws DSEInternalErrorException,
                                    DSEInvalidRequestException,
                                    DSEInvalidArgumentException,
                                    DSESQLException,
                                    DSEException
Retrieves the columns in aColumnsVector of all the records within the database table that match the search condition. The retrieved records are then unformatted into the aContext using anOutputFormat.

Specified by:
retrieveRecordsMatching in interface TableService
Parameters:
aSearchCondition - java.lang.String - the search condition in SQL format
aColumnsVector - Vector - the vector that contains the columns to be retrieved
aContext - Context - the context into which the retrieved records will be unformatted
anOutputFormat - FormatElement - the formatter to unformat the retrieved records
Throws:
DSEInvalidRequestException - if the request is not valid
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSEException - if an exception is thrown when calling the pool of connections

retrieveRecordsMatching

public void retrieveRecordsMatching(java.lang.String aSearchCondition,
                                    Vector aColumnsVector,
                                    Context aContext,
                                    java.lang.String anOutputFormatName)
                             throws DSEInternalErrorException,
                                    DSEInvalidRequestException,
                                    DSEInvalidArgumentException,
                                    DSESQLException,
                                    DSEException,
                                    java.io.IOException
Retrieves the columns in aColumnsVector of all the records within the database table that match the search condition. The retrieved records are then unformatted into the aContext using the format named anOutputFormatName.

Specified by:
retrieveRecordsMatching in interface TableService
Parameters:
aSearchCondition - java.lang.String - the search condition in SQL format
aColumnsVector - Vector - the vector that contains the columns to be retrieved
aContext - Context - the context into which the retrieved records will be unformatted
anOutputFormatName - java.lang.String - the name of the formatter to unformat the retrieved records
Throws:
DSEInvalidRequestException - if the request is not valid
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSEException - if an exception is thrown when calling the pool of connections
java.io.IOException - if there is an error instanciating the formatter from its external definition

rollback

public void rollback()
              throws DSESQLException,
                     DSEException
Rolls back all the database changes if the autoCommit attribute is set to false.

Specified by:
rollback in interface TableService
Throws:
DSESQLException - when rollback fails
DSEException

setAutoConnect

public void setAutoConnect(boolean b)
                    throws DSEException
Sets the autoConnect attribute to a boolean.

Specified by:
setAutoConnect in interface TableService
Parameters:
b - boolean
Throws:
DSEException

setCatalogName

public void setCatalogName(java.lang.String s)
                    throws DSEException
Sets the catalog attribute to the string provided as argument.

Specified by:
setCatalogName in interface TableService
Parameters:
s - java.lang.String
Throws:
DSEException

setPrimaryKeys

public void setPrimaryKeys(boolean newPrimaryKeys)
                    throws DSEException
Sets the primaryKeys attribute value to newPrimaryKeys.

Specified by:
setPrimaryKeys in interface TableService
Parameters:
newPrimaryKeys - boolean
Throws:
DSEException

setSchemaName

public void setSchemaName(java.lang.String s)
                   throws DSEException
Sets the schema attribute to the string provided as an argument.

Specified by:
setSchemaName in interface TableService
Parameters:
s - java.lang.String
Throws:
DSEException

setTableName

public void setTableName(java.lang.String s)
                  throws DSEException
Sets the tableName attribute to the string provided as an argument.

Specified by:
setTableName in interface TableService
Parameters:
s - java.lang.String
Throws:
DSEException

updateRecordsMatching

public int updateRecordsMatching(java.lang.String aSearchCondition,
                                 Context aContext,
                                 FormatElement aHashtableFormat)
                          throws DSEInvalidRequestException,
                                 DSEInvalidArgumentException,
                                 DSESQLException,
                                 DSEException
Updates all of the table records that match the search condition with the result from formatting the context data using the aHashtableFormat.

Specified by:
updateRecordsMatching in interface TableService
Parameters:
aSearchCondition - java.lang.String
aContext - Context
aHashtableFormat - HashtableFormat
Returns:
int - the number of updated records
Throws:
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSEException - if an exception is thrown when calling the pool of connections
DSESQLException - if an SQLException is caught

updateRecordsMatching

public int updateRecordsMatching(java.lang.String aSearchCondition,
                                 Context aContext,
                                 FormatElement aHashtableFormat,
                                 Vector aColumnsVector)
                          throws DSEInvalidRequestException,
                                 DSEInvalidArgumentException,
                                 DSESQLException,
                                 DSEException
Updates the columns specified in aColumnsVector for the records that match the search condition with the data provided in the operation context. The aHashtableFormat must only format the new data values.

Specified by:
updateRecordsMatching in interface TableService
Parameters:
aSearchCondition - java.lang.String
aContext - Context
aHashtableFormat - HashtableFormat
aColumnsVector - Vector the vector that contains the columns to be updated
Returns:
int - the number of updated records
Throws:
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSEException - if an exception is thrown when calling the pool of connections
DSESQLException - if an SQLException is caught

updateRecordsMatching

public int updateRecordsMatching(java.lang.String aSearchCondition,
                                 Context aContext,
                                 java.lang.String aFormatName)
                          throws DSEInvalidRequestException,
                                 DSEInternalErrorException,
                                 DSEInvalidArgumentException,
                                 DSESQLException,
                                 DSEInvalidClassException,
                                 DSEException,
                                 java.io.IOException
Updates all the table records that match the search condition with the result from formatting the context data using the formatter defined as aFormatName.

Specified by:
updateRecordsMatching in interface TableService
Parameters:
aSearchCondition - java.lang.String - the search condition
aContext - Context - the context containing the new data values
aFormatName - java.lang.String - the name of the formatter that needs to be instantiated to format the data that is in the context
Returns:
int - the number of updated records
Throws:
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSEException - if an exception is thrown when calling the pool of connections
DSEInvalidClassException - if there is an error in the formatting process
java.io.IOException - if there is an error instanciating the formatter from its external definition

updateRecordsMatching

public int updateRecordsMatching(java.lang.String aSearchCondition,
                                 Context aContext,
                                 java.lang.String aFormatName,
                                 Vector aColumnsVector)
                          throws DSEInvalidArgumentException,
                                 DSEInternalErrorException,
                                 DSEInvalidRequestException,
                                 DSESQLException,
                                 DSEInvalidClassException,
                                 DSEException,
                                 java.io.IOException
Updates the columns specified in aColumnsVector for the records that match the search condition with the data provided in the operation context. The format identified by aHashtableFormatName must only format the new data values.

Specified by:
updateRecordsMatching in interface TableService
Parameters:
aSearchCondition - java.lang.String
aContext - Context - the context containing the new data values
aFormatName - java.lang.String - the name of the format that needs to be instantiated to format the data that is in the context
aColumnsVector - Vector - the vector that contains the columns to be updated
Returns:
int - the number of updated records
Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSEInvalidRequestException - if the request is not valid
DSESQLException - if an SQLException is caught
DSEException - if an exception is thrown when calling the pool of connections
DSEInvalidClassException - if there is an error in the formatting process
java.io.IOException - if there is an error instanciating the formatter from its external definition

updateRecordsMatching

public int updateRecordsMatching(java.lang.String aSearchCondition,
                                 Hashtable aDataHashtable)
                          throws DSEInvalidRequestException,
                                 DSEInternalErrorException,
                                 DSEInvalidArgumentException,
                                 DSESQLException,
                                 DSEException
Updates all the table records that match the search condition with the Hashtable data.

Specified by:
updateRecordsMatching in interface TableService
Parameters:
aSearchCondition - java.lang.String - the search condition
aDataHashtable - Hashtable - the Hashtable that contains the new data
Returns:
int - the number of updated records
Throws:
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - is an SQLException is caught
DSEException - if an exception is thrown when calling the pool of connections

updateRecordsMatching

public int updateRecordsMatching(java.lang.String aSearchCondition,
                                 Hashtable aDataHashtable,
                                 Vector aColumnsVector)
                          throws DSEInvalidArgumentException,
                                 DSEInternalErrorException,
                                 DSEInvalidRequestException,
                                 DSESQLException,
                                 DSEException
Updates the columns specified in aColumnsVector for all the records which match the search condition with the data provided in aDataHashtable. The aDataHashtable must contain only the data field values of the columns that have to be updated in the database.

Specified by:
updateRecordsMatching in interface TableService
Parameters:
aSearchCondition - java.lang.String
aDataHashtable - Hashtable - the Hashtable that contains the new data
aColumnsVector - Vector - the vector that contains the columns to be changed
Returns:
int - the number of updated records
Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSEInvalidRequestException - if the request is not valid
DSESQLException - if an SQLException is caught
DSEException - if an exception is thrown when calling the pool of connections

IBM Branch Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2005