Package org.apache.hop.databases.db2
Class DB2DatabaseMeta
- java.lang.Object
-
- org.apache.hop.core.database.BaseDatabaseMeta
-
- org.apache.hop.databases.db2.DB2DatabaseMeta
-
@DatabaseMetaPlugin(type="DB2", typeDescription="DB2", documentationUrl="/database/databases/db2.html") @GuiPlugin(id="GUI-DB2DatabaseMeta") public class DB2DatabaseMeta extends BaseDatabaseMeta implements IDatabase
Contains DB2 specific information through static final members
-
-
Field Summary
-
Fields inherited from class org.apache.hop.core.database.BaseDatabaseMeta
accessType, ATTRIBUTE_FORCE_IDENTIFIERS_TO_LOWERCASE, ATTRIBUTE_FORCE_IDENTIFIERS_TO_UPPERCASE, ATTRIBUTE_MSSQL_DOUBLE_DECIMAL_SEPARATOR, ATTRIBUTE_PREFERRED_SCHEMA_NAME, ATTRIBUTE_PREFIX_EXTRA_OPTION, ATTRIBUTE_PRESERVE_RESERVED_WORD_CASE, ATTRIBUTE_QUOTE_ALL_FIELDS, ATTRIBUTE_SQL_CONNECT, ATTRIBUTE_SUPPORTS_BOOLEAN_DATA_TYPE, ATTRIBUTE_SUPPORTS_TIMESTAMP_DATA_TYPE, ATTRIBUTE_USE_RESULT_STREAMING, attributes, AUTOINCREMENT_SQL_FOR_BATCH_ID, databaseName, dataTablespace, hostname, ID_PASSWORD_LABEL, ID_PASSWORD_WIDGET, ID_USERNAME_LABEL, ID_USERNAME_WIDGET, indexTablespace, manualUrl, password, pluginId, pluginName, port, releaseSavepoint, SELECT_COUNT_STATEMENT, SEQUENCE_FOR_BATCH_ID, servername, username
-
-
Constructor Summary
Constructors Constructor Description DB2DatabaseMeta()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int[]getAccessTypeList()StringgetAddColumnStatement(String tableName, IValueMeta v, String tk, boolean useAutoinc, String pk, boolean semicolon)Generates the SQL statement to add a column to the specified tableintgetDefaultDatabasePort()StringgetDriverClass()StringgetDropColumnStatement(String tableName, IValueMeta v, String tk, boolean useAutoinc, String pk, boolean semicolon)Generates the SQL statement to drop a column from the specified tableStringgetExtraOptionIndicator()StringgetFieldDefinition(IValueMeta v, String tk, String pk, boolean useAutoinc, boolean addFieldName, boolean addCr)intgetMaxVARCHARLength()Get the maximum length of a text field (VARCHAR) for this database connection.StringgetModifyColumnStatement(String tableName, IValueMeta v, String tk, boolean useAutoinc, String pk, boolean semicolon)Generates the SQL statement to modify a column in the specified tableString[]getReservedWords()StringgetSqlCurrentSequenceValue(String sequenceName)Get the current value of a database sequenceStringgetSqlInsertAutoIncUnknownDimensionRow(String schemaTable, String keyField, String versionField)Get the SQL to insert a new empty unknown record in a dimension.StringgetSqlListOfSequences()StringgetSqlLockTables(String[] tableNames)StringgetSqlNextSequenceValue(String sequenceName)Get the SQL to get the next value of a sequence.StringgetSqlSequenceExists(String sequenceName)Check if a sequence exists.StringgetSqlUnlockTables(String[] tableName)StringgetTruncateTableStatement(String tableName)StringgetURL(String hostname, String port, String databaseName)booleanisDisplaySizeTwiceThePrecision()booleanisRequiresCastToVariousForIsNull()booleanisSupportsBatchUpdates()booleanisSupportsGetBlob()booleanisSupportsNewLinesInSql()booleanisSupportsOptionsInURL()booleanisSupportsSchemas()booleanisSupportsSequenceNoMaxValueOption()booleanisSupportsSequences()booleanisSupportsSetCharacterStream()-
Methods inherited from class org.apache.hop.core.database.BaseDatabaseMeta
addAttribute, addDefaultOptions, addExtraOption, canTest, clone, customizeValueFromSqlType, generateColumnAlias, getAccessType, getAttribute, getAttributeProperty, getAttributeProperty, getAttributes, getConnectSql, getCreateTableStatement, getDatabaseFactoryName, getDatabaseName, getDataTablespace, getDataTablespaceDDL, getDefaultOptions, getDropTableIfExistsStatement, getEndQuote, getExtraOptions, getExtraOptionSeparator, getExtraOptionsHelpText, getExtraOptionValueSeparator, getFieldnameProtector, getFunctionAverage, getFunctionCount, getFunctionMaximum, getFunctionMinimum, getFunctionSum, getHostname, getIndexTablespace, getIndexTablespaceDDL, getLimitClause, getManualUrl, getMaxColumnsInIndex, getMaxTextFieldLength, getNotFoundTK, getPassword, getPluginId, getPluginName, getPort, getPreferredSchemaName, getSafeFieldname, getSchemaTableCombination, getSelectCountStatement, getSequenceNoMaxValueOption, getServername, getSqlColumnExists, getSqlDeleteStmt, getSqlInsertClauseBeforeFields, getSqlListOfProcedures, getSqlListOfSchemas, getSqlQueryFields, getSqlScriptStatements, getSqlTableExists, getSqlUpdateStmt, getSqlValue, getStartQuote, getSynonymTypes, getTablespaceDDL, getTableTypes, getUsername, getValueFromResultSet, getViewTypes, hasIndex, isChanged, isDefaultingToUppercase, isExasolVariant, isExplorable, isFetchSizeSupported, isForcingIdentifiersToLowerCase, isForcingIdentifiersToUpperCase, isFullExceptionLog, isInformixVariant, isMsSqlServerNativeVariant, isMsSqlServerVariant, isMySqlVariant, isNeedsPlaceHolder, isNeoviewVariant, isNetezzaVariant, isOracleVariant, isPostgresVariant, isPreserveReservedCase, isQuoteAllFields, isQuoteReservedWords, isReleaseSavepoint, isRequiresCreateTablePrimaryKeyAppend, isRequiresName, isRequiringTransactionsOnQueries, isSqliteVariant, isStreamingResults, isStrictBigNumberInterpretation, isSupportsAutoGeneratedKeys, isSupportsAutoInc, isSupportsBitmapIndex, isSupportsBooleanDataType, isSupportsCatalogs, isSupportsCustomDeleteStmt, isSupportsCustomUpdateStmt, isSupportsEmptyTransactions, isSupportsErrorHandling, IsSupportsErrorHandlingOnBatchUpdates, isSupportsFloatRoundingOnUpdate, isSupportsPreparedStatementMetadataRetrieval, isSupportsResultSetMetadataRetrievalOnly, isSupportsSetLong, isSupportsSetMaxRows, isSupportsSynonyms, isSupportsTimestampDataType, isSupportsTimeStampToDateConversion, isSupportsTransactions, isSupportsViews, isSybaseIQVariant, isSybaseVariant, isSystemTable, isTeradataVariant, isUseSafePoints, isUsingDoubleDecimalAsSchemaTableSeparator, onlySpaces, parseStatements, quoteSqlString, setAccessType, setAttributes, setChanged, setConnectSql, setDatabaseName, setDataTablespace, setForcingIdentifiersToLowerCase, setForcingIdentifiersToUpperCase, setHostname, setIndexTablespace, setManualUrl, setPassword, setPluginId, setPluginName, setPort, setPreferredSchemaName, setPreserveReservedCase, setQuoteAllFields, setServername, setStreamingResults, setSupportsBooleanDataType, setSupportsTimestampDataType, setUsername, setUsingDoubleDecimalAsSchemaTableSeparator, useSchemaNameForTableList
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.hop.core.database.IDatabase
addAttribute, addDefaultOptions, addExtraOption, clone, createSqlScriptParser, customizeValueFromSqlType, generateColumnAlias, getAccessType, getAttribute, getAttributes, getConnectSql, getCreateTableStatement, getDatabaseFactoryName, getDatabaseName, getDataTablespace, getDataTablespaceDDL, getDefaultOptions, getDropTableIfExistsStatement, getEndQuote, getExtraOptions, getExtraOptionSeparator, getExtraOptionsHelpText, getExtraOptionValueSeparator, getFunctionAverage, getFunctionCount, getFunctionMaximum, getFunctionMinimum, getFunctionSum, getHostname, getIndexTablespace, getIndexTablespaceDDL, getLegacyColumnName, getLimitClause, getManualUrl, getMaxColumnsInIndex, getMaxTextFieldLength, getNotFoundTK, getPassword, getPluginId, getPluginName, getPort, getPreferredSchemaName, getSafeFieldname, getSchemaTableCombination, getSelectCountStatement, getSequenceNoMaxValueOption, getServername, getSqlColumnExists, getSqlDeleteStmt, getSqlInsertClauseBeforeFields, getSqlListOfProcedures, getSqlListOfSchemas, getSqlQueryFields, getSqlScriptStatements, getSqlTableExists, getSqlUpdateStmt, getSqlValue, getStartQuote, getSynonymTypes, getTableTypes, getUnsupportedTableOutputMessage, getUsername, getValueFromResultSet, getViewTypes, hasIndex, isChanged, isDefaultingToUppercase, isExasolVariant, isExplorable, isFetchSizeSupported, isForcingIdentifiersToLowerCase, isForcingIdentifiersToUpperCase, isFullExceptionLog, isInformixVariant, isMsSqlServerNativeVariant, isMsSqlServerVariant, isMySqlVariant, isNeedsPlaceHolder, isNeoviewVariant, isNetezzaVariant, isOracleVariant, isPostgresVariant, isPreserveReservedCase, isQuoteAllFields, isQuoteReservedWords, isReleaseSavepoint, isRequiresCreateTablePrimaryKeyAppend, isRequiresName, isRequiringTransactionsOnQueries, isSqliteVariant, isStreamingResults, isStrictBigNumberInterpretation, isSupportsAutoGeneratedKeys, isSupportsAutoInc, isSupportsBitmapIndex, isSupportsBooleanDataType, isSupportsCatalogs, isSupportsCustomDeleteStmt, isSupportsCustomUpdateStmt, isSupportsEmptyTransactions, isSupportsErrorHandling, IsSupportsErrorHandlingOnBatchUpdates, isSupportsFloatRoundingOnUpdate, isSupportsPreparedStatementMetadataRetrieval, isSupportsResultSetMetadataRetrievalOnly, isSupportsSetLong, isSupportsSetMaxRows, isSupportsSynonyms, isSupportsTimestampDataType, isSupportsTimeStampToDateConversion, isSupportsTransactions, isSupportsViews, isSybaseIQVariant, isSybaseVariant, isSystemTable, isTeradataVariant, isUseSafePoints, isUsingDoubleDecimalAsSchemaTableSeparator, parseStatements, quoteSqlString, setAccessType, setAttributes, setChanged, setConnectSql, setDatabaseName, setDataTablespace, setForcingIdentifiersToLowerCase, setForcingIdentifiersToUpperCase, setHostname, setIndexTablespace, setManualUrl, setPassword, setPluginId, setPluginName, setPort, setPreferredSchemaName, setPreserveReservedCase, setQuoteAllFields, setServername, setStreamingResults, setSupportsBooleanDataType, setSupportsTimestampDataType, setUsername, setUsingDoubleDecimalAsSchemaTableSeparator, supportsStandardTableOutput, useSchemaNameForTableList
-
-
-
-
Method Detail
-
getAccessTypeList
public int[] getAccessTypeList()
- Specified by:
getAccessTypeListin interfaceIDatabase- Specified by:
getAccessTypeListin classBaseDatabaseMeta
-
getDefaultDatabasePort
public int getDefaultDatabasePort()
- Specified by:
getDefaultDatabasePortin interfaceIDatabase- Overrides:
getDefaultDatabasePortin classBaseDatabaseMeta
-
isSupportsSetCharacterStream
public boolean isSupportsSetCharacterStream()
- Specified by:
isSupportsSetCharacterStreamin interfaceIDatabase- Overrides:
isSupportsSetCharacterStreamin classBaseDatabaseMeta
-
getDriverClass
public String getDriverClass()
- Specified by:
getDriverClassin interfaceIDatabase
-
isSupportsSchemas
public boolean isSupportsSchemas()
- Specified by:
isSupportsSchemasin interfaceIDatabase- Overrides:
isSupportsSchemasin classBaseDatabaseMeta- Returns:
- true if the database supports schemas, DB2 supports it (v7 and v8 for sure).
-
getTruncateTableStatement
public String getTruncateTableStatement(String tableName)
- Specified by:
getTruncateTableStatementin interfaceIDatabase- Overrides:
getTruncateTableStatementin classBaseDatabaseMeta- Parameters:
tableName- The table to be truncated.- Returns:
- The SQL statement to truncate a table: remove all rows from it without a transaction
-
getAddColumnStatement
public String getAddColumnStatement(String tableName, IValueMeta v, String tk, boolean useAutoinc, String pk, boolean semicolon)
Generates the SQL statement to add a column to the specified table- Specified by:
getAddColumnStatementin interfaceIDatabase- Parameters:
tableName- The table to addv- The column defined as a valuetk- the name of the technical key fielduseAutoinc- whether or not this field uses auto incrementpk- the name of the primary key fieldsemicolon- whether or not to add a semi-colon behind the statement.- Returns:
- the SQL statement to add a column to the specified table
-
getDropColumnStatement
public String getDropColumnStatement(String tableName, IValueMeta v, String tk, boolean useAutoinc, String pk, boolean semicolon)
Generates the SQL statement to drop a column from the specified table- Specified by:
getDropColumnStatementin interfaceIDatabase- Overrides:
getDropColumnStatementin classBaseDatabaseMeta- Parameters:
tableName- The table to addv- The column defined as a valuetk- the name of the technical key fielduseAutoinc- whether or not this field uses auto incrementpk- the name of the primary key fieldsemicolon- whether or not to add a semi-colon behind the statement.- Returns:
- the SQL statement to drop a column from the specified table
-
getModifyColumnStatement
public String getModifyColumnStatement(String tableName, IValueMeta v, String tk, boolean useAutoinc, String pk, boolean semicolon)
Generates the SQL statement to modify a column in the specified table- Specified by:
getModifyColumnStatementin interfaceIDatabase- Parameters:
tableName- The table to addv- The column defined as a valuetk- the name of the technical key fielduseAutoinc- whether or not this field uses auto incrementpk- the name of the primary key fieldsemicolon- whether or not to add a semi-colon behind the statement.- Returns:
- the SQL statement to modify a column in the specified table
-
getFieldDefinition
public String getFieldDefinition(IValueMeta v, String tk, String pk, boolean useAutoinc, boolean addFieldName, boolean addCr)
- Specified by:
getFieldDefinitionin interfaceIDatabase
-
getReservedWords
public String[] getReservedWords()
- Specified by:
getReservedWordsin interfaceIDatabase- Overrides:
getReservedWordsin classBaseDatabaseMeta
-
getSqlLockTables
public String getSqlLockTables(String[] tableNames)
- Specified by:
getSqlLockTablesin interfaceIDatabase- Overrides:
getSqlLockTablesin classBaseDatabaseMeta
-
getSqlUnlockTables
public String getSqlUnlockTables(String[] tableName)
- Specified by:
getSqlUnlockTablesin interfaceIDatabase- Overrides:
getSqlUnlockTablesin classBaseDatabaseMeta
-
getMaxVARCHARLength
public int getMaxVARCHARLength()
Get the maximum length of a text field (VARCHAR) for this database connection. If this size is exceeded use a CLOB.- Specified by:
getMaxVARCHARLengthin interfaceIDatabase- Overrides:
getMaxVARCHARLengthin classBaseDatabaseMeta- Returns:
- The maximum VARCHAR field length for this database type. (mostly identical to getMaxTextFieldLength() - CLOB_LENGTH)
-
isSupportsBatchUpdates
public boolean isSupportsBatchUpdates()
- Specified by:
isSupportsBatchUpdatesin interfaceIDatabase- Overrides:
isSupportsBatchUpdatesin classBaseDatabaseMeta
-
isSupportsGetBlob
public boolean isSupportsGetBlob()
- Specified by:
isSupportsGetBlobin interfaceIDatabase- Overrides:
isSupportsGetBlobin classBaseDatabaseMeta- Returns:
- false because the DB2 JDBC driver doesn't support getBlob on the resultset. We must use getBytes() to get the data.
-
isSupportsSequences
public boolean isSupportsSequences()
- Specified by:
isSupportsSequencesin interfaceIDatabase- Overrides:
isSupportsSequencesin classBaseDatabaseMeta- Returns:
- true if the database supports sequences
-
getSqlListOfSequences
public String getSqlListOfSequences()
- Specified by:
getSqlListOfSequencesin interfaceIDatabase- Overrides:
getSqlListOfSequencesin classBaseDatabaseMeta
-
getSqlSequenceExists
public String getSqlSequenceExists(String sequenceName)
Check if a sequence exists.- Specified by:
getSqlSequenceExistsin interfaceIDatabase- Overrides:
getSqlSequenceExistsin classBaseDatabaseMeta- Parameters:
sequenceName- The sequence to check- Returns:
- The SQL to get the name of the sequence back from the databases data dictionary
-
getSqlCurrentSequenceValue
public String getSqlCurrentSequenceValue(String sequenceName)
Get the current value of a database sequence- Specified by:
getSqlCurrentSequenceValuein interfaceIDatabase- Overrides:
getSqlCurrentSequenceValuein classBaseDatabaseMeta- Parameters:
sequenceName- The sequence to check- Returns:
- The current value of a database sequence
-
getSqlNextSequenceValue
public String getSqlNextSequenceValue(String sequenceName)
Get the SQL to get the next value of a sequence. (Oracle only)- Specified by:
getSqlNextSequenceValuein interfaceIDatabase- Overrides:
getSqlNextSequenceValuein classBaseDatabaseMeta- Parameters:
sequenceName- The sequence name- Returns:
- the SQL to get the next value of a sequence. (Oracle only)
-
getExtraOptionIndicator
public String getExtraOptionIndicator()
- Specified by:
getExtraOptionIndicatorin interfaceIDatabase- Overrides:
getExtraOptionIndicatorin classBaseDatabaseMeta- Returns:
- This indicator separates the normal URL from the options. DB2 is special in the sense that it requires a : instead of the usual ;.
-
isSupportsSequenceNoMaxValueOption
public boolean isSupportsSequenceNoMaxValueOption()
- Specified by:
isSupportsSequenceNoMaxValueOptionin interfaceIDatabase- Overrides:
isSupportsSequenceNoMaxValueOptionin classBaseDatabaseMeta- Returns:
- true if the database supports the NOMAXVALUE sequence option. The default is false, AS/400 and DB2 support this.
-
isRequiresCastToVariousForIsNull
public boolean isRequiresCastToVariousForIsNull()
- Specified by:
isRequiresCastToVariousForIsNullin interfaceIDatabase- Overrides:
isRequiresCastToVariousForIsNullin classBaseDatabaseMeta- Returns:
- true if the database requires you to cast a parameter to varchar before comparing to null. Only required for DB2 and Vertica
-
isDisplaySizeTwiceThePrecision
public boolean isDisplaySizeTwiceThePrecision()
- Specified by:
isDisplaySizeTwiceThePrecisionin interfaceIDatabase- Overrides:
isDisplaySizeTwiceThePrecisionin classBaseDatabaseMeta- Returns:
- Handles the special case of DB2 where the display size returned is twice the precision. In that case, the length is the precision.
-
isSupportsNewLinesInSql
public boolean isSupportsNewLinesInSql()
- Specified by:
isSupportsNewLinesInSqlin interfaceIDatabase- Overrides:
isSupportsNewLinesInSqlin classBaseDatabaseMeta- Returns:
- true if the database supports newlines in a SQL statements.
-
getSqlInsertAutoIncUnknownDimensionRow
public String getSqlInsertAutoIncUnknownDimensionRow(String schemaTable, String keyField, String versionField)
Get the SQL to insert a new empty unknown record in a dimension.- Specified by:
getSqlInsertAutoIncUnknownDimensionRowin interfaceIDatabase- Overrides:
getSqlInsertAutoIncUnknownDimensionRowin classBaseDatabaseMeta- Parameters:
schemaTable- the schema-table name to insert intokeyField- The key fieldversionField- the version field- Returns:
- the SQL to insert the unknown record into the SCD.
-
isSupportsOptionsInURL
public boolean isSupportsOptionsInURL()
- Specified by:
isSupportsOptionsInURLin interfaceIDatabase- Overrides:
isSupportsOptionsInURLin classBaseDatabaseMeta
-
-