com.ibm.dse.services.jdbc
Class JDBCStoreSchemaGenerator

java.lang.Object
  |
  +--com.ibm.dse.services.jdbc.JDBCServicesAdministrator
        |
        +--com.ibm.dse.services.jdbc.JDBCStoreSchemaGenerator

public class JDBCStoreSchemaGenerator
extends JDBCServicesAdministrator

The JDBCStoreSchemaGenerator class is responsible for creating the Table for a Store Schema and generating the SGML for the specified JDBCStore formatter.


Field Summary
static java.lang.String catalogName
          Keeps the store catalog name
static boolean createSchema
          Keeps the createSchema attribute value.
 java.lang.String databaseName
          Keeps the databaseName attribute value.
 java.lang.String indexName
          Keeps the indexName attribute value.
static java.lang.String schemaName
          Keeps the store schema name
 
Fields inherited from class com.ibm.dse.services.jdbc.JDBCServicesAdministrator
COMPID, databaseConnection
 
Constructor Summary
JDBCStoreSchemaGenerator()
          This constructor creates a JDBCStoreSchemaGenerator object.
 
Method Summary
 void generateTable(java.lang.String aTableName, java.lang.String aTableDefinition)
          Generates the store table in the selected database with aTableName name.
 void generateTable(java.lang.String aSchemaName, java.lang.String aTableName, java.lang.String aTableDefinition)
          Generates the store table in the selected database with aTableName name.
static java.lang.String getCatalogName()
          Returns the catalogName attribute value.
 java.lang.String getDatabaseName()
          Returns the databaseName attribute.
 java.lang.String getIndexName()
          Returns the indexName attribute.
protected static DatabaseResultSetMetaData getMetaData(java.lang.String aTableName)
          Returns the DatabaseResultSetMetaData associated with a Store Table.
static java.lang.String getSchemaName()
          Returns the schemaName attribute value.
static boolean isCreateSchema()
          Returns the createSchema attribute value.
 void loadDriver()
          Loads the JDBC Driver as set in the JournalConstants ST_DEFAULT_JDBCDRIVER attribute.
 void loadDriver(java.lang.String aDriverName)
          Loads the JDBC Driver explicitly provided as an argument.
static void setCatalogName(java.lang.String s)
          Sets the catalogName attribute to the string provided as argument.
static void setCreateSchema(boolean newCreateSchema)
          Sets the createSchema attribute value to newCreateSchema.
 void setDatabaseName(java.lang.String newDatabaseName)
          Sets the databaseName attribute value to newDatabaseName.
 void setIndexName(java.lang.String newIndexName)
          Sets the indexName attribute value to newIndexName.
static void setSchemaName(java.lang.String s)
          Sets the schemaName attribute to the string provided as an argument.
 
Methods inherited from class com.ibm.dse.services.jdbc.JDBCServicesAdministrator
connect, connect, disconnect, dropProcedure, getProcedureMetaData, isRegistered, isRegistered, registerProcedure
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

schemaName

public static java.lang.String schemaName
Keeps the store schema name

catalogName

public static java.lang.String catalogName
Keeps the store catalog name

databaseName

public java.lang.String databaseName
Keeps the databaseName attribute value. This attribute is used when working with DB2 UDB in OS/390. In this environment, the database URL as set in the database connection has the following format: jdbc:db2os390:", where is the name of a shared database subsystem with different databases and storage groups defined in it. If not specified, the store table will be created in the default database within this location.

createSchema

public static boolean createSchema
Keeps the createSchema attribute value. This attribute is set to true if the database schema representing the journal schema is to be created in the database, executing a CREATE SCHEMA statement. If this attribute is set to false, the database schema will not be created.

indexName

public java.lang.String indexName
Keeps the indexName attribute value. This attribute is used when working with DB2 UDB in OS/390. In this environment, when a table is created, also an index on that table must be created ( while in other operating systems a default index is automatically created). This attribute contains the index name to be used in the CREATE INDEX statement. Default value is the store contant ST_RECID_COLUMN_NAME value.
Constructor Detail

JDBCStoreSchemaGenerator

public JDBCStoreSchemaGenerator()
This constructor creates a JDBCStoreSchemaGenerator object.
Method Detail

generateTable

public void generateTable(java.lang.String aTableName,
                          java.lang.String aTableDefinition)
                   throws DSEInvalidArgumentException,
                          DSESQLException,
                          DSEInternalErrorException,
                          DSEInvalidRequestException
Generates the store table in the selected database with aTableName name. The argument aTableDefinition contains the definition of the columns within the table in SQL format.
Parameters:
aTableName - java.lang.String
aTableDefinition - 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

generateTable

public void generateTable(java.lang.String aSchemaName,
                          java.lang.String aTableName,
                          java.lang.String aTableDefinition)
                   throws DSEInvalidArgumentException,
                          DSESQLException,
                          DSEInternalErrorException,
                          DSEInvalidRequestException
Generates the store table in the selected database with aTableName name. The argument aTableDefinition contains the definition of the columns within the table in SQL format.
Parameters:
aSchemaName - java.lang.String
aTableName - java.lang.String
aTableDefinition - 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

getCatalogName

public static java.lang.String getCatalogName()
Returns the catalogName attribute value.
Returns:
java.lang.String

getDatabaseName

public java.lang.String getDatabaseName()
Returns the databaseName attribute. Used in OS/390 environment to identify the database inside the location referenced by the database URL where the table is to be created.
Returns:
java.lang.String

getIndexName

public java.lang.String getIndexName()
Returns the indexName attribute. Used in OS/390 environment to create an index on the store table DSERECID column named indexName.
Returns:
java.lang.String

getMetaData

protected static DatabaseResultSetMetaData getMetaData(java.lang.String aTableName)
                                                throws DSEInvalidArgumentException,
                                                       DSEInternalErrorException,
                                                       DSESQLException
Returns the DatabaseResultSetMetaData associated with a Store Table. Checks first if this information already exists in the tablesMetaData Hashtable and, if it is not found, gets the information from the Database and adds it to the tablesMetaData Hashtable.
Parameters:
aTableName - java.lang.String, the store table name
Returns:
DatabaseResultSetMetaData
Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQL Exception is caught

getSchemaName

public static java.lang.String getSchemaName()
Returns the schemaName attribute value.
Returns:
java.lang.String

isCreateSchema

public static boolean isCreateSchema()
Returns the createSchema attribute value.
Returns:
boolean

loadDriver

public void loadDriver()
                throws DSEInternalErrorException
Loads the JDBC Driver as set in the JournalConstants ST_DEFAULT_JDBCDRIVER attribute.
Throws:
DSEInternalErrorException - if an internal program error occurs

loadDriver

public void loadDriver(java.lang.String aDriverName)
                throws DSEInternalErrorException
Loads the JDBC Driver explicitly provided as an argument.
Parameters:
aDriverName - java.lang.String, the driver name (full path)
Throws:
DSEInternalErrorException - if an internal program error occurs

setCatalogName

public static void setCatalogName(java.lang.String s)
Sets the catalogName attribute to the string provided as argument.
Parameters:
s - java.lang.String

setCreateSchema

public static void setCreateSchema(boolean newCreateSchema)
Sets the createSchema attribute value to newCreateSchema.
Parameters:
newCreateSchema - boolean

setDatabaseName

public void setDatabaseName(java.lang.String newDatabaseName)
Sets the databaseName attribute value to newDatabaseName.
Parameters:
newDatabaseName - java.lang.String

setIndexName

public void setIndexName(java.lang.String newIndexName)
Sets the indexName attribute value to newIndexName.
Parameters:
newIndex - java.lang.String

setSchemaName

public static void setSchemaName(java.lang.String s)
Sets the schemaName attribute to the string provided as an argument.
Parameters:
s - java.lang.String