liquibase.database
Class DB2Database

java.lang.Object
  extended by liquibase.database.AbstractDatabase
      extended by liquibase.database.DB2Database
All Implemented Interfaces:
Database, DatabaseObject

public class DB2Database
extends AbstractDatabase


Field Summary
 
Fields inherited from class liquibase.database.AbstractDatabase
currentDateTimeFunction, log
 
Constructor Summary
DB2Database()
           
 
Method Summary
 java.lang.Object convertDatabaseValueToJavaObject(java.lang.Object defaultValue, int dataType, int columnSize, int decimalDigits)
           
 java.lang.String convertRequestedSchemaToCatalog(java.lang.String requestedSchema)
           
 java.lang.String convertRequestedSchemaToSchema(java.lang.String requestedSchema)
           
 DatabaseSnapshot createDatabaseSnapshot(java.lang.String schema, java.util.Set<DiffStatusListener> statusListeners)
           
 SqlStatement createFindSequencesSQL(java.lang.String schema)
           
 java.lang.String generatePrimaryKeyName(java.lang.String tableName)
           
 java.lang.String getAutoIncrementClause()
          Returns database-specific auto-increment DDL clause.
 java.lang.String getBlobType()
          Returns the actual database-specific data type to use a "BLOB" column.
 java.lang.String getBooleanType()
          Returns the actual database-specific data type to use a "boolean" column.
 java.lang.String getClobType()
          Returns the actual database-specific data type to use a "CLOB" column.
 java.lang.String getCurrencyType()
          Returns the actual database-specific data type to use a "currency" column.
 java.lang.String getCurrentDateTimeFunction()
          Returns database-specific function for generating the current date/time.
 java.lang.String getDateLiteral(java.lang.String isoDate)
          Return an DB2 date literal with the same value as a string formatted using ISO 8601.
 java.lang.String getDateTimeType()
          Returns the actual database-specific data type to use a "datetime" column.
protected  java.lang.String getDefaultDatabaseSchemaName()
           
 java.lang.String getDefaultDriver(java.lang.String url)
          If this database understands the given url, return the default driver class name.
 java.lang.String getFalseBooleanValue()
          The database-specific value to use for "false" "boolean" columns.
 java.lang.String getProductName()
          Returns the full database product name.
 java.lang.String getTrueBooleanValue()
          The database-specific value to use for "true" "boolean" columns.
 java.lang.String getTypeName()
          Returns an all-lower-case short name of the product.
 java.lang.String getUUIDType()
          Returns the actual database-specific data type to use a "UUID" column.
 java.lang.String getViewDefinition(java.lang.String schemaName, java.lang.String name)
           
 SqlStatement getViewDefinitionSql(java.lang.String schemaName, java.lang.String name)
           
 boolean isColumnAutoIncrement(java.lang.String schemaName, java.lang.String tableName, java.lang.String columnName)
           
 boolean isCorrectDatabaseImplementation(java.sql.Connection conn)
          Is this AbstractDatabase subclass the correct one to use for the given connection.
protected  java.util.Date parseDate(java.lang.String dateAsString)
           
 boolean shouldQuoteValue(java.lang.String value)
           
 boolean supportsInitiallyDeferrableColumns()
          Returns whether this database support initially deferrable columns.
 boolean supportsTablespaces()
           
 
Methods inherited from class liquibase.database.AbstractDatabase
canCreateChangeLogTable, checkDatabaseChangeLogLockTable, checkDatabaseChangeLogTable, close, commit, convertJavaObjectToString, convertToCorrectJavaType, doesChangeLogLockTableExist, doesChangeLogTableExist, doesTagExist, dropDatabaseObjects, equals, escapeColumnName, escapeColumnNameList, escapeConstraintName, escapeIndexName, escapeSequenceName, escapeStringForDatabase, escapeTableName, escapeViewName, getAutoCommitMode, getBigIntType, getCharType, getColumnType, getColumnType, getConcatSql, getConnection, getConnectionURL, getConnectionUsername, getCreateChangeLogLockSQL, getCreateChangeLogSQL, getDatabaseChangeLogLockTableName, getDatabaseChangeLogTableName, getDatabaseMajorVersion, getDatabaseMinorVersion, getDatabaseProductName, getDatabaseProductName, getDatabaseProductVersion, getDatabaseType, getDateLiteral, getDateLiteral, getDateLiteral, getDateLiteral, getDateType, getDefaultCatalogName, getDefaultSchemaName, getDoubleType, getDriverName, getFloatType, getIntType, getJdbcTemplate, getLineComment, getObjectEscapeCharacter, getRanChangeSet, getRanChangeSetList, getRanDate, getRunStatus, getSelectChangeLogLockSQL, getSystemTablesAndViews, getTimeType, getTinyIntType, getVarcharType, hashCode, isAutoCommit, isDateOnly, isDateTime, isLiquibaseTable, isLocalDatabase, isSystemTable, isSystemView, isTimeOnly, markChangeSetAsRan, markChangeSetAsReRan, removeRanStatus, rollback, setAutoCommit, setConnection, setConnection, setCurrentDateTimeFunction, setDatabaseChangeLogLockTableName, setDatabaseChangeLogTableName, setDefaultSchemaName, setJdbcTemplate, supportsAutoIncrement, supportsDDLInTransaction, supportsRestrictForeignKeys, supportsSchemas, supportsSequences, tag, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DB2Database

public DB2Database()
Method Detail

isCorrectDatabaseImplementation

public boolean isCorrectDatabaseImplementation(java.sql.Connection conn)
                                        throws JDBCException
Description copied from interface: Database
Is this AbstractDatabase subclass the correct one to use for the given connection.

Throws:
JDBCException

getDefaultDriver

public java.lang.String getDefaultDriver(java.lang.String url)
Description copied from interface: Database
If this database understands the given url, return the default driver class name. Otherwise return null.


getProductName

public java.lang.String getProductName()
Description copied from interface: Database
Returns the full database product name. May be different than what the JDBC connection reports (getDatabaseProductName())


getTypeName

public java.lang.String getTypeName()
Description copied from interface: Database
Returns an all-lower-case short name of the product. Used for end-user selecting of database type such as the DBMS precondition.


getDefaultDatabaseSchemaName

protected java.lang.String getDefaultDatabaseSchemaName()
                                                 throws JDBCException
Overrides:
getDefaultDatabaseSchemaName in class AbstractDatabase
Throws:
JDBCException

supportsInitiallyDeferrableColumns

public boolean supportsInitiallyDeferrableColumns()
Description copied from interface: Database
Returns whether this database support initially deferrable columns.


getAutoIncrementClause

public java.lang.String getAutoIncrementClause()
Description copied from class: AbstractDatabase
Returns database-specific auto-increment DDL clause.

Specified by:
getAutoIncrementClause in interface Database
Overrides:
getAutoIncrementClause in class AbstractDatabase

getCurrentDateTimeFunction

public java.lang.String getCurrentDateTimeFunction()
Description copied from interface: Database
Returns database-specific function for generating the current date/time.


getBooleanType

public java.lang.String getBooleanType()
Description copied from interface: Database
Returns the actual database-specific data type to use a "boolean" column.


getTrueBooleanValue

public java.lang.String getTrueBooleanValue()
Description copied from class: AbstractDatabase
The database-specific value to use for "true" "boolean" columns.

Specified by:
getTrueBooleanValue in interface Database
Overrides:
getTrueBooleanValue in class AbstractDatabase

getFalseBooleanValue

public java.lang.String getFalseBooleanValue()
Description copied from class: AbstractDatabase
The database-specific value to use for "false" "boolean" columns.

Specified by:
getFalseBooleanValue in interface Database
Overrides:
getFalseBooleanValue in class AbstractDatabase

getDateLiteral

public java.lang.String getDateLiteral(java.lang.String isoDate)
Return an DB2 date literal with the same value as a string formatted using ISO 8601.

Convert an ISO8601 date string to one of the following results: to_date('1995-05-23', 'YYYY-MM-DD') to_date('1995-05-23 09:23:59', 'YYYY-MM-DD HH24:MI:SS')

Implementation restriction: Currently, only the following subsets of ISO8601 are supported: YYYY-MM-DD hh:mm:ss YYYY-MM-DDThh:mm:ss

Specified by:
getDateLiteral in interface Database
Overrides:
getDateLiteral in class AbstractDatabase

getCurrencyType

public java.lang.String getCurrencyType()
Description copied from interface: Database
Returns the actual database-specific data type to use a "currency" column.


getUUIDType

public java.lang.String getUUIDType()
Description copied from interface: Database
Returns the actual database-specific data type to use a "UUID" column.


getClobType

public java.lang.String getClobType()
Description copied from interface: Database
Returns the actual database-specific data type to use a "CLOB" column.


getBlobType

public java.lang.String getBlobType()
Description copied from interface: Database
Returns the actual database-specific data type to use a "BLOB" column.


getDateTimeType

public java.lang.String getDateTimeType()
Description copied from interface: Database
Returns the actual database-specific data type to use a "datetime" column.


createFindSequencesSQL

public SqlStatement createFindSequencesSQL(java.lang.String schema)
                                    throws JDBCException
Specified by:
createFindSequencesSQL in interface Database
Overrides:
createFindSequencesSQL in class AbstractDatabase
Throws:
JDBCException

shouldQuoteValue

public boolean shouldQuoteValue(java.lang.String value)
Specified by:
shouldQuoteValue in interface Database
Overrides:
shouldQuoteValue in class AbstractDatabase

supportsTablespaces

public boolean supportsTablespaces()

getViewDefinitionSql

public SqlStatement getViewDefinitionSql(java.lang.String schemaName,
                                         java.lang.String name)
                                  throws JDBCException
Overrides:
getViewDefinitionSql in class AbstractDatabase
Throws:
JDBCException

getViewDefinition

public java.lang.String getViewDefinition(java.lang.String schemaName,
                                          java.lang.String name)
                                   throws JDBCException
Specified by:
getViewDefinition in interface Database
Overrides:
getViewDefinition in class AbstractDatabase
Throws:
JDBCException

convertDatabaseValueToJavaObject

public java.lang.Object convertDatabaseValueToJavaObject(java.lang.Object defaultValue,
                                                         int dataType,
                                                         int columnSize,
                                                         int decimalDigits)
                                                  throws java.text.ParseException
Specified by:
convertDatabaseValueToJavaObject in interface Database
Overrides:
convertDatabaseValueToJavaObject in class AbstractDatabase
Throws:
java.text.ParseException

parseDate

protected java.util.Date parseDate(java.lang.String dateAsString)
                            throws DateParseException
Overrides:
parseDate in class AbstractDatabase
Throws:
DateParseException

convertRequestedSchemaToSchema

public java.lang.String convertRequestedSchemaToSchema(java.lang.String requestedSchema)
                                                throws JDBCException
Specified by:
convertRequestedSchemaToSchema in interface Database
Overrides:
convertRequestedSchemaToSchema in class AbstractDatabase
Throws:
JDBCException

convertRequestedSchemaToCatalog

public java.lang.String convertRequestedSchemaToCatalog(java.lang.String requestedSchema)
                                                 throws JDBCException
Specified by:
convertRequestedSchemaToCatalog in interface Database
Overrides:
convertRequestedSchemaToCatalog in class AbstractDatabase
Throws:
JDBCException

generatePrimaryKeyName

public java.lang.String generatePrimaryKeyName(java.lang.String tableName)
Specified by:
generatePrimaryKeyName in interface Database
Overrides:
generatePrimaryKeyName in class AbstractDatabase

isColumnAutoIncrement

public boolean isColumnAutoIncrement(java.lang.String schemaName,
                                     java.lang.String tableName,
                                     java.lang.String columnName)
                              throws java.sql.SQLException,
                                     JDBCException
Specified by:
isColumnAutoIncrement in interface Database
Overrides:
isColumnAutoIncrement in class AbstractDatabase
Throws:
java.sql.SQLException
JDBCException

createDatabaseSnapshot

public DatabaseSnapshot createDatabaseSnapshot(java.lang.String schema,
                                               java.util.Set<DiffStatusListener> statusListeners)
                                        throws JDBCException
Specified by:
createDatabaseSnapshot in interface Database
Specified by:
createDatabaseSnapshot in class AbstractDatabase
Throws:
JDBCException