Class BaseDatabaseMeta

    • Field Detail

      • ATTRIBUTE_PORT_NUMBER

        public static final String ATTRIBUTE_PORT_NUMBER
        The port number of the database as string: allows for parameterization.
        See Also:
        Constant Field Values
      • ATTRIBUTE_SQL_CONNECT

        public static final String ATTRIBUTE_SQL_CONNECT
        The SQL to execute at connect time (right after connecting)
        See Also:
        Constant Field Values
      • ATTRIBUTE_USE_POOLING

        public static final String ATTRIBUTE_USE_POOLING
        A flag to determine if we should use connection pooling or not.
        See Also:
        Constant Field Values
      • ATTRIBUTE_MAXIMUM_POOL_SIZE

        public static final String ATTRIBUTE_MAXIMUM_POOL_SIZE
        If we use connection pooling, this would contain the maximum pool size
        See Also:
        Constant Field Values
      • ATTRIBUTE_INITIAL_POOL_SIZE

        public static final String ATTRIBUTE_INITIAL_POOL_SIZE
        If we use connection pooling, this would contain the initial pool size
        See Also:
        Constant Field Values
      • ATTRIBUTE_PREFIX_EXTRA_OPTION

        public static final String ATTRIBUTE_PREFIX_EXTRA_OPTION
        The prefix for all the extra options attributes
        See Also:
        Constant Field Values
      • ATTRIBUTE_IS_CLUSTERED

        public static final String ATTRIBUTE_IS_CLUSTERED
        A flag to determine if the connection is clustered or not.
        See Also:
        Constant Field Values
      • ATTRIBUTE_CLUSTER_HOSTNAME_PREFIX

        public static final String ATTRIBUTE_CLUSTER_HOSTNAME_PREFIX
        The clustering hostname prefix
        See Also:
        Constant Field Values
      • ATTRIBUTE_CLUSTER_PORT_PREFIX

        public static final String ATTRIBUTE_CLUSTER_PORT_PREFIX
        The clustering port prefix
        See Also:
        Constant Field Values
      • ATTRIBUTE_CLUSTER_DBNAME_PREFIX

        public static final String ATTRIBUTE_CLUSTER_DBNAME_PREFIX
        The clustering database name prefix
        See Also:
        Constant Field Values
      • ATTRIBUTE_CLUSTER_USERNAME_PREFIX

        public static final String ATTRIBUTE_CLUSTER_USERNAME_PREFIX
        The clustering database username prefix
        See Also:
        Constant Field Values
      • ATTRIBUTE_CLUSTER_PASSWORD_PREFIX

        public static final String ATTRIBUTE_CLUSTER_PASSWORD_PREFIX
        The clustering database password prefix
        See Also:
        Constant Field Values
      • ATTRIBUTE_POOLING_PARAMETER_PREFIX

        public static final String ATTRIBUTE_POOLING_PARAMETER_PREFIX
        The pooling parameters
        See Also:
        Constant Field Values
      • ATTRIBUTE_USE_RESULT_STREAMING

        public static final String ATTRIBUTE_USE_RESULT_STREAMING
        A flag to determine if we should use result streaming on MySQL
        See Also:
        Constant Field Values
      • ATTRIBUTE_MSSQL_DOUBLE_DECIMAL_SEPARATOR

        public static final String ATTRIBUTE_MSSQL_DOUBLE_DECIMAL_SEPARATOR
        A flag to determine if we should use a double decimal separator to specify schema/table combinations on MS-SQL server
        See Also:
        Constant Field Values
      • ATTRIBUTE_QUOTE_ALL_FIELDS

        public static final String ATTRIBUTE_QUOTE_ALL_FIELDS
        A flag to determine if we should quote all fields
        See Also:
        Constant Field Values
      • ATTRIBUTE_FORCE_IDENTIFIERS_TO_LOWERCASE

        public static final String ATTRIBUTE_FORCE_IDENTIFIERS_TO_LOWERCASE
        A flag to determine if we should force all identifiers to lower case
        See Also:
        Constant Field Values
      • ATTRIBUTE_FORCE_IDENTIFIERS_TO_UPPERCASE

        public static final String ATTRIBUTE_FORCE_IDENTIFIERS_TO_UPPERCASE
        A flag to determine if we should force all identifiers to UPPER CASE
        See Also:
        Constant Field Values
      • ATTRIBUTE_PREFERRED_SCHEMA_NAME

        public static final String ATTRIBUTE_PREFERRED_SCHEMA_NAME
        The preferred schema to use if no other has been specified.
        See Also:
        Constant Field Values
      • ATTRIBUTE_SUPPORTS_BOOLEAN_DATA_TYPE

        public static final String ATTRIBUTE_SUPPORTS_BOOLEAN_DATA_TYPE
        Checkbox to allow you to configure if the database supports the boolean data type or not. Defaults to "false" for backward compatibility!
        See Also:
        Constant Field Values
      • ATTRIBUTE_SUPPORTS_TIMESTAMP_DATA_TYPE

        public static final String ATTRIBUTE_SUPPORTS_TIMESTAMP_DATA_TYPE
        Checkbox to allow you to configure if the database supports the Timestamp data type or not. Defaults to "false" for backward compatibility!
        See Also:
        Constant Field Values
      • ATTRIBUTE_PRESERVE_RESERVED_WORD_CASE

        public static final String ATTRIBUTE_PRESERVE_RESERVED_WORD_CASE
        Checkbox to allow you to configure if the reserved words will have their case changed during the handleCase call
        See Also:
        Constant Field Values
      • releaseSavepoint

        protected boolean releaseSavepoint
        Boolean to indicate if savepoints can be released Most databases do, so we set it to true. Child classes can overwrite with false if need be.
      • SELECT_COUNT_STATEMENT

        public static final String SELECT_COUNT_STATEMENT
        The SQL, minus the table name, to select the number of rows from a table
        See Also:
        Constant Field Values
    • Constructor Detail

      • BaseDatabaseMeta

        public BaseDatabaseMeta()
    • Method Detail

      • getAccessTypeList

        public abstract int[] getAccessTypeList()
        Description copied from interface: DatabaseInterface
        Get the list of possible access types for a database.
        Specified by:
        getAccessTypeList in interface DatabaseInterface
        Returns:
        the list of possible access types for a database.
      • setAccessType

        public void setAccessType​(int accessType)
        Specified by:
        setAccessType in interface DatabaseInterface
        Parameters:
        accessType - The accessType to set.
      • setChanged

        public void setChanged​(boolean changed)
        Specified by:
        setChanged in interface DatabaseInterface
        Parameters:
        changed - The changed to set.
      • setName

        public void setName​(String name)
        Specified by:
        setName in interface DatabaseInterface
        Parameters:
        name - The connection Name to set.
      • setDisplayName

        public void setDisplayName​(String displayName)
        Specified by:
        setDisplayName in interface DatabaseInterface
        Parameters:
        displayName - The un-escaped connection Name to set.
      • setDatabasePortNumberString

        public void setDatabasePortNumberString​(String databasePortNumberString)
        Specified by:
        setDatabasePortNumberString in interface DatabaseInterface
        Parameters:
        databasePortNumberString - The databasePortNumber string to set.
      • setDataTablespace

        public void setDataTablespace​(String dataTablespace)
        Specified by:
        setDataTablespace in interface DatabaseInterface
        Parameters:
        dataTablespace - The data tablespace to set.
      • setIndexTablespace

        public void setIndexTablespace​(String indexTablespace)
        Specified by:
        setIndexTablespace in interface DatabaseInterface
        Parameters:
        indexTablespace - The index tablespace to set.
      • setAttributes

        public void setAttributes​(Properties attributes)
        Set extra attributes on this database connection
        Specified by:
        setAttributes in interface DatabaseInterface
        Parameters:
        attributes - The extra attributes to set on this database connection.
      • clone

        public Object clone()
        Clone the basic settings for this connection!
        Specified by:
        clone in interface DatabaseInterface
        Overrides:
        clone in class Object
        Returns:
        the cloned Database Interface object.
      • supportsSetCharacterStream

        public boolean supportsSetCharacterStream()
        See if this database supports the setCharacterStream() method on a PreparedStatement.
        Specified by:
        supportsSetCharacterStream in interface DatabaseInterface
        Returns:
        true if we can set a Stream on a field in a PreparedStatement. False if not.
      • supportsAutoInc

        public boolean supportsAutoInc()
        Specified by:
        supportsAutoInc in interface DatabaseInterface
        Returns:
        Whether or not the database can use auto increment type of fields (pk)
      • getLimitClause

        public String getLimitClause​(int nrRows)
        Specified by:
        getLimitClause in interface DatabaseInterface
        Parameters:
        nrRows - The number of rows to which we want to limit the result of the query.
        Returns:
        the clause after a select statement to limit the number of rows
      • getNotFoundTK

        public int getNotFoundTK​(boolean useAutoinc)
        Description copied from interface: DatabaseInterface
        Get the not found technical key.
        Specified by:
        getNotFoundTK in interface DatabaseInterface
        Parameters:
        useAutoinc - Whether or not we want to use an auto increment field
        Returns:
        the lowest possible technical key to be used as the NOT FOUND row in a slowly changing dimension.
      • getSQLNextSequenceValue

        public String getSQLNextSequenceValue​(String sequenceName)
        Get the SQL to get the next value of a sequence. (Oracle/PGSQL only)
        Specified by:
        getSQLNextSequenceValue in interface DatabaseInterface
        Parameters:
        sequenceName - The sequence name
        Returns:
        the SQL to get the next value of a sequence. (Oracle/PGSQL only)
      • getSQLCurrentSequenceValue

        public String getSQLCurrentSequenceValue​(String sequenceName)
        Get the current value of a database sequence
        Specified by:
        getSQLCurrentSequenceValue in interface DatabaseInterface
        Parameters:
        sequenceName - The sequence to check
        Returns:
        The current value of a database sequence
      • getSQLSequenceExists

        public String getSQLSequenceExists​(String sequenceName)
        Check if a sequence exists.
        Specified by:
        getSQLSequenceExists in interface DatabaseInterface
        Parameters:
        sequenceName - The sequence to check
        Returns:
        The SQL to get the name of the sequence back from the databases data dictionary
      • isFetchSizeSupported

        public boolean isFetchSizeSupported()
        Checks whether or not the command setFetchSize() is supported by the JDBC driver...
        Specified by:
        isFetchSizeSupported in interface DatabaseInterface
        Returns:
        true is setFetchSize() is supported!
      • needsPlaceHolder

        public boolean needsPlaceHolder()
        Indicates the need to insert a placeholder (0) for auto increment fields.
        Specified by:
        needsPlaceHolder in interface DatabaseInterface
        Returns:
        true if we need a placeholder for auto increment fields in insert statements.
      • supportsSchemas

        public boolean supportsSchemas()
        Specified by:
        supportsSchemas in interface DatabaseInterface
        Returns:
        true if the database supports schemas
      • supportsCatalogs

        public boolean supportsCatalogs()
        Specified by:
        supportsCatalogs in interface DatabaseInterface
        Returns:
        true if the database supports catalogs
      • supportsEmptyTransactions

        public boolean supportsEmptyTransactions()
        Specified by:
        supportsEmptyTransactions in interface DatabaseInterface
        Returns:
        true when the database engine supports empty transaction. (for example Informix does not on a non-ANSI database type!)
      • getSchemaTableCombination

        public String getSchemaTableCombination​(String schemaName,
                                                String tablePart)
        Get the schema-table combination to query the right table. Usually that is SCHEMA.TABLENAME, however there are exceptions to this rule...
        Specified by:
        getSchemaTableCombination in interface DatabaseInterface
        Parameters:
        schemaName - The schema name
        tablePart - The tablename
        Returns:
        the schema-table combination to query the right table.
      • getBackwardsCompatibleSchemaTableCombination

        @Deprecated
        public String getBackwardsCompatibleSchemaTableCombination​(String schemaPart,
                                                                   String tablePart)
        Deprecated.
        we should phase this out in 5.0, but it's there to keep backwards compatibility in the 4.x releases.
        Checks for quotes before quoting schema and table. Many dialects had hardcoded quotes, they probably didn't get updated properly when quoteFields() was introduced to DatabaseMeta.
        Parameters:
        schemaPart -
        tablePart -
        Returns:
        quoted schema and table
      • getBackwardsCompatibleTable

        @Deprecated
        public String getBackwardsCompatibleTable​(String tablePart)
        Deprecated.
        we should phase this out in 5.0, but it's there to keep backwards compatibility in the 4.x releases.
        Checks for quotes before quoting table. Many dialects had hardcoded quotes, they probably didn't get updated properly when quoteFields() was introduced to DatabaseMeta.
        Parameters:
        tablePart -
        Returns:
        quoted table
      • getMaxTextFieldLength

        public int getMaxTextFieldLength()
        Get the maximum length of a text field for this database connection. This includes optional CLOB, Memo and Text fields. (the maximum!)
        Specified by:
        getMaxTextFieldLength in interface DatabaseInterface
        Returns:
        The maximum text field length for this database type. (mostly CLOB_LENGTH)
      • 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:
        getMaxVARCHARLength in interface DatabaseInterface
        Returns:
        The maximum VARCHAR field length for this database type. (mostly identical to getMaxTextFieldLength() - CLOB_LENGTH)
      • supportsSequences

        public boolean supportsSequences()
        Specified by:
        supportsSequences in interface DatabaseInterface
        Returns:
        true if the database supports sequences
      • supportsBitmapIndex

        public boolean supportsBitmapIndex()
        Specified by:
        supportsBitmapIndex in interface DatabaseInterface
        Returns:
        true if the database supports bitmap indexes
      • supportsSetLong

        public boolean supportsSetLong()
        Specified by:
        supportsSetLong in interface DatabaseInterface
        Returns:
        true if the database JDBC driver supports the setLong command
      • getDropColumnStatement

        public String getDropColumnStatement​(String tablename,
                                             ValueMetaInterface v,
                                             String tk,
                                             boolean useAutoinc,
                                             String pk,
                                             boolean semicolon)
        Generates the SQL statement to drop a column from the specified table
        Specified by:
        getDropColumnStatement in interface DatabaseInterface
        Parameters:
        tablename - The table to add
        v - The column defined as a value
        tk - the name of the technical key field
        useAutoinc - whether or not this field uses auto increment
        pk - the name of the primary key field
        semicolon - whether or not to add a semi-colon behind the statement.
        Returns:
        the SQL statement to drop a column from the specified table
      • quoteReservedWords

        public boolean quoteReservedWords()
        Specified by:
        quoteReservedWords in interface DatabaseInterface
        Returns:
        true if reserved words need to be double quoted ("password", "select", ...)
      • getStartQuote

        public String getStartQuote()
        Specified by:
        getStartQuote in interface DatabaseInterface
        Returns:
        The start quote sequence, mostly just double quote, but sometimes [, ...
      • getEndQuote

        public String getEndQuote()
        Specified by:
        getEndQuote in interface DatabaseInterface
        Returns:
        The end quote sequence, mostly just double quote, but sometimes ], ...
      • supportsRepository

        public boolean supportsRepository()
        Specified by:
        supportsRepository in interface DatabaseInterface
        Returns:
        true if Kettle can create a repository on this type of database.
      • useSchemaNameForTableList

        public boolean useSchemaNameForTableList()
        Specified by:
        useSchemaNameForTableList in interface DatabaseInterface
        Returns:
        true if we need to supply the schema-name to getTables in order to get a correct list of items.
      • supportsViews

        public boolean supportsViews()
        Specified by:
        supportsViews in interface DatabaseInterface
        Returns:
        true if the database supports views
      • supportsSynonyms

        public boolean supportsSynonyms()
        Specified by:
        supportsSynonyms in interface DatabaseInterface
        Returns:
        true if the database supports synonyms
      • getTruncateTableStatement

        public String getTruncateTableStatement​(String tableName)
        Specified by:
        getTruncateTableStatement in interface DatabaseInterface
        Parameters:
        tableName - The table to be truncated.
        Returns:
        The SQL statement to truncate a table: remove all rows from it without a transaction
      • getSQLQueryFields

        public String getSQLQueryFields​(String tableName)
        Returns the minimal SQL to launch in order to determine the layout of the resultset for a given database table
        Specified by:
        getSQLQueryFields in interface DatabaseInterface
        Parameters:
        tableName - The name of the table to determine the layout for
        Returns:
        The SQL to launch.
      • supportsFloatRoundingOnUpdate

        public boolean supportsFloatRoundingOnUpdate()
        Most databases round number(7,2) 17.29999999 to 17.30, but some don't.
        Specified by:
        supportsFloatRoundingOnUpdate in interface DatabaseInterface
        Returns:
        true if the database supports roundinf of floating point data on update/insert
      • getSQLLockTables

        public String getSQLLockTables​(String[] tableNames)
        Specified by:
        getSQLLockTables in interface DatabaseInterface
        Parameters:
        tableNames - The names of the tables to lock
        Returns:
        The SQL command to lock database tables for write purposes. null is returned in case locking is not supported on the target database. null is the default value
      • getSQLUnlockTables

        public String getSQLUnlockTables​(String[] tableNames)
        Specified by:
        getSQLUnlockTables in interface DatabaseInterface
        Parameters:
        tableNames - The names of the tables to unlock
        Returns:
        The SQL command to unlock database tables. null is returned in case locking is not supported on the target database. null is the default value
      • supportsTimeStampToDateConversion

        public boolean supportsTimeStampToDateConversion()
        Specified by:
        supportsTimeStampToDateConversion in interface DatabaseInterface
        Returns:
        true if the database supports timestamp to date conversion. For example Interbase doesn't support this!
      • supportsBatchUpdates

        public boolean supportsBatchUpdates()
        Specified by:
        supportsBatchUpdates in interface DatabaseInterface
        Returns:
        true if the database JDBC driver supports batch updates For example Interbase doesn't support this!
      • supportsBooleanDataType

        public boolean supportsBooleanDataType()
        Specified by:
        supportsBooleanDataType in interface DatabaseInterface
        Returns:
        true if the database supports a boolean, bit, logical, ... datatype The default is false: map to a string.
      • setSupportsBooleanDataType

        public void setSupportsBooleanDataType​(boolean b)
        Specified by:
        setSupportsBooleanDataType in interface DatabaseInterface
        Parameters:
        b - Set to true if the database supports a boolean, bit, logical, ... datatype
      • supportsTimestampDataType

        public boolean supportsTimestampDataType()
        Specified by:
        supportsTimestampDataType in interface DatabaseInterface
        Returns:
        true if the database supports the Timestamp data type (nanosecond precision and all)
      • setSupportsTimestampDataType

        public void setSupportsTimestampDataType​(boolean b)
        Specified by:
        setSupportsTimestampDataType in interface DatabaseInterface
        Parameters:
        b - Set to true if the database supports the Timestamp data type (nanosecond precision and all)
      • preserveReservedCase

        public boolean preserveReservedCase()
        Specified by:
        preserveReservedCase in interface DatabaseInterface
        Returns:
        true if reserved words' case should be preserved
      • setPreserveReservedCase

        public void setPreserveReservedCase​(boolean b)
        Specified by:
        setPreserveReservedCase in interface DatabaseInterface
        Parameters:
        b - Set to true if reserved words' case should be preserved
      • isDefaultingToUppercase

        public boolean isDefaultingToUppercase()
        Specified by:
        isDefaultingToUppercase in interface DatabaseInterface
        Returns:
        true if the database defaults to naming tables and fields in uppercase. True for most databases except for stuborn stuff like Postgres ;-)
      • addExtraOption

        public void addExtraOption​(String databaseTypeCode,
                                   String option,
                                   String value)
        Add an extra option to the attributes list
        Specified by:
        addExtraOption in interface DatabaseInterface
        Parameters:
        databaseTypeCode - The database type code for which the option applies
        option - The option to set
        value - The value of the option
      • getExtraOptionSeparator

        public String getExtraOptionSeparator()
        Specified by:
        getExtraOptionSeparator in interface DatabaseInterface
        Returns:
        The extra option separator in database URL for this platform (usually this is semicolon ; )
      • getExtraOptionValueSeparator

        public String getExtraOptionValueSeparator()
        Specified by:
        getExtraOptionValueSeparator in interface DatabaseInterface
        Returns:
        The extra option value separator in database URL for this platform (usually this is the equal sign = )
      • supportsOptionsInURL

        public boolean supportsOptionsInURL()
        Specified by:
        supportsOptionsInURL in interface DatabaseInterface
        Returns:
        true if the database supports connection options in the URL, false if they are put in a Properties object.
      • supportsGetBlob

        public boolean supportsGetBlob()
        Specified by:
        supportsGetBlob in interface DatabaseInterface
        Returns:
        true if the database JDBC driver supports getBlob on the resultset. If not we must use getBytes() to get the data.
      • setConnectSQL

        public void setConnectSQL​(String sql)
        Specified by:
        setConnectSQL in interface DatabaseInterface
        Parameters:
        sql - The SQL to execute right after connecting
      • supportsSetMaxRows

        public boolean supportsSetMaxRows()
        Specified by:
        supportsSetMaxRows in interface DatabaseInterface
        Returns:
        true if the database supports setting the maximum number of return rows in a resultset.
      • isUsingConnectionPool

        public boolean isUsingConnectionPool()
        Specified by:
        isUsingConnectionPool in interface DatabaseInterface
        Returns:
        true if we want to use a database connection pool
      • setUsingConnectionPool

        public void setUsingConnectionPool​(boolean usePool)
        Specified by:
        setUsingConnectionPool in interface DatabaseInterface
        Parameters:
        usePool - true if we want to use a database connection pool
      • setMaximumPoolSize

        public void setMaximumPoolSize​(int maximumPoolSize)
        Specified by:
        setMaximumPoolSize in interface DatabaseInterface
        Parameters:
        maximumPoolSize - the maximum pool size
      • setInitialPoolSize

        public void setInitialPoolSize​(int initialPoolSize)
        Specified by:
        setInitialPoolSize in interface DatabaseInterface
        Parameters:
        initialPoolSize - the initial pool size
      • isPartitioned

        public boolean isPartitioned()
        Specified by:
        isPartitioned in interface DatabaseInterface
        Returns:
        true if we want to use a database connection pool
      • setPartitioned

        public void setPartitioned​(boolean clustered)
        Specified by:
        setPartitioned in interface DatabaseInterface
        Parameters:
        clustered - true if we want to use a database connection pool
      • getConnectionPoolingProperties

        public Properties getConnectionPoolingProperties()
        Specified by:
        getConnectionPoolingProperties in interface DatabaseInterface
        Returns:
        The set of properties (newly created object) that contains the connection pooling parameters All environment variables will be replaced here.
      • getSQLTableExists

        public String getSQLTableExists​(String tablename)
        Specified by:
        getSQLTableExists in interface DatabaseInterface
        Parameters:
        tablename - The table to verify the existance for
        Returns:
        The SQL to execute to verify if the given table exists. If an Exception is thrown for this SQL, we don't have the table.
      • getSQLColumnExists

        public String getSQLColumnExists​(String columnname,
                                         String tablename)
        Specified by:
        getSQLColumnExists in interface DatabaseInterface
        Parameters:
        columnname - The column to verify the existance for
        tablename - The table to verify the existance for
        Returns:
        The SQL to execute to verify if the given table exists. If an Exception is thrown for this SQL, we don't have the column.
      • needsToLockAllTables

        public boolean needsToLockAllTables()
        Specified by:
        needsToLockAllTables in interface DatabaseInterface
        Returns:
        true if the database needs all repository tables to be locked, not just one ref table (R_REPOSITORY_LOG)
      • isStreamingResults

        public boolean isStreamingResults()
        Specified by:
        isStreamingResults in interface DatabaseInterface
        Returns:
        true if the database is streaming results (normally this is an option just for MySQL).
      • setStreamingResults

        public void setStreamingResults​(boolean useStreaming)
        Specified by:
        setStreamingResults in interface DatabaseInterface
        Parameters:
        useStreaming - true if we want the database to stream results (normally this is an option just for MySQL).
      • isQuoteAllFields

        public boolean isQuoteAllFields()
        Specified by:
        isQuoteAllFields in interface DatabaseInterface
        Returns:
        true if all fields should always be quoted in db
      • setQuoteAllFields

        public void setQuoteAllFields​(boolean quoteAllFields)
        Specified by:
        setQuoteAllFields in interface DatabaseInterface
        Parameters:
        quoteAllFields - true if we want the database to stream results (normally this is an option just for MySQL).
      • setForcingIdentifiersToLowerCase

        public void setForcingIdentifiersToLowerCase​(boolean forceLowerCase)
        Specified by:
        setForcingIdentifiersToLowerCase in interface DatabaseInterface
        Parameters:
        forceLowerCase - true if all identifiers should be forced to lower case
      • setForcingIdentifiersToUpperCase

        public void setForcingIdentifiersToUpperCase​(boolean forceUpperCase)
        Specified by:
        setForcingIdentifiersToUpperCase in interface DatabaseInterface
        Parameters:
        forceUpperCase - true if all identifiers should be forced to upper case
      • isUsingDoubleDecimalAsSchemaTableSeparator

        public boolean isUsingDoubleDecimalAsSchemaTableSeparator()
        Specified by:
        isUsingDoubleDecimalAsSchemaTableSeparator in interface DatabaseInterface
        Returns:
        true if we use a double decimal separator to specify schema/table combinations on MS-SQL server
      • setUsingDoubleDecimalAsSchemaTableSeparator

        public void setUsingDoubleDecimalAsSchemaTableSeparator​(boolean useDoubleDecimalSeparator)
        Specified by:
        setUsingDoubleDecimalAsSchemaTableSeparator in interface DatabaseInterface
        Parameters:
        useDoubleDecimalSeparator - true if we should use a double decimal separator to specify schema/table combinations on MS-SQL server
      • isRequiringTransactionsOnQueries

        public boolean isRequiringTransactionsOnQueries()
        Specified by:
        isRequiringTransactionsOnQueries in interface DatabaseInterface
        Returns:
        true if this database needs a transaction to perform a query (auto-commit turned off).
      • getDatabaseFactoryName

        public String getDatabaseFactoryName()
        You can use this method to supply an alternate factory for the test method in the dialogs. This is useful for plugins like SAP/R3 and PALO.
        Specified by:
        getDatabaseFactoryName in interface DatabaseInterface
        Returns:
        the name of the database test factory to use.
      • setPreferredSchemaName

        public void setPreferredSchemaName​(String preferredSchemaName)
        Specified by:
        setPreferredSchemaName in interface DatabaseInterface
        Parameters:
        preferredSchemaName - The preferred schema name of this database connection.
      • supportsSequenceNoMaxValueOption

        public boolean supportsSequenceNoMaxValueOption()
        Specified by:
        supportsSequenceNoMaxValueOption in interface DatabaseInterface
        Returns:
        true if the database supports the NOMAXVALUE sequence option. The default is false, AS/400 and DB2 support this.
      • requiresCreateTablePrimaryKeyAppend

        public boolean requiresCreateTablePrimaryKeyAppend()
        Specified by:
        requiresCreateTablePrimaryKeyAppend in interface DatabaseInterface
        Returns:
        true if we need to append the PRIMARY KEY block in the create table block after the fields, required for Cache.
      • requiresCastToVariousForIsNull

        public boolean requiresCastToVariousForIsNull()
        Specified by:
        requiresCastToVariousForIsNull in interface DatabaseInterface
        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:
        isDisplaySizeTwiceThePrecision in interface DatabaseInterface
        Returns:
        Handles the special case of DB2 where the display size returned is twice the precision. In that case, the length is the precision.
      • supportsPreparedStatementMetadataRetrieval

        public boolean supportsPreparedStatementMetadataRetrieval()
        Most databases allow you to retrieve result metadata by preparing a SELECT statement.
        Specified by:
        supportsPreparedStatementMetadataRetrieval in interface DatabaseInterface
        Returns:
        true if the database supports retrieval of query metadata from a prepared statement. False if the query needs to be executed first.
      • supportsResultSetMetadataRetrievalOnly

        public boolean supportsResultSetMetadataRetrievalOnly()
        Specified by:
        supportsResultSetMetadataRetrievalOnly in interface DatabaseInterface
        Returns:
        true if this database only supports metadata retrieval on a result set, never on a statement (even if the statement has been executed)
      • isSystemTable

        public boolean isSystemTable​(String tableName)
        Specified by:
        isSystemTable in interface DatabaseInterface
        Parameters:
        tableName -
        Returns:
        true if the specified table is a system table
      • supportsNewLinesInSQL

        public boolean supportsNewLinesInSQL()
        Specified by:
        supportsNewLinesInSQL in interface DatabaseInterface
        Returns:
        true if the database supports newlines in a SQL statements.
      • getSQLListOfSchemas

        public String getSQLListOfSchemas()
        Specified by:
        getSQLListOfSchemas in interface DatabaseInterface
        Returns:
        the SQL to retrieve the list of schemas or null if the JDBC metadata needs to be used.
      • getMaxColumnsInIndex

        public int getMaxColumnsInIndex()
        Specified by:
        getMaxColumnsInIndex in interface DatabaseInterface
        Returns:
        The maximum number of columns in a database, <=0 means: no known limit
      • supportsErrorHandlingOnBatchUpdates

        public boolean supportsErrorHandlingOnBatchUpdates()
        Specified by:
        supportsErrorHandlingOnBatchUpdates in interface DatabaseInterface
        Returns:
        true if the database supports error handling (recovery of failure) while doing batch updates.
      • 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:
        getSQLInsertAutoIncUnknownDimensionRow in interface DatabaseInterface
        Parameters:
        schemaTable - the schema-table name to insert into
        keyField - The key field
        versionField - the version field
        Returns:
        the SQL to insert the unknown record into the SCD.
      • isExplorable

        public boolean isExplorable()
        Specified by:
        isExplorable in interface DatabaseInterface
        Returns:
        true if this is a relational database you can explore. Return false for SAP, PALO, etc.
      • getXulOverlayFile

        public String getXulOverlayFile()
        Specified by:
        getXulOverlayFile in interface DatabaseInterface
        Returns:
        The name of the XUL overlay file to display extra options. This is only used in case of a non-standard plugin. Usually this method returns null.
      • quoteSQLString

        public String quoteSQLString​(String string)
        Description copied from interface: DatabaseInterface
        Adds quotes around the string according to the database dialect and also escapes special characters like CR, LF and the quote character itself.
        Specified by:
        quoteSQLString in interface DatabaseInterface
        Parameters:
        string -
        Returns:
        A string that is properly quoted for use in a SQL statement (insert, update, delete, etc)
      • generateColumnAlias

        public String generateColumnAlias​(int columnIndex,
                                          String suggestedName)
        Description copied from interface: DatabaseInterface
        Generate a column alias given the column index and suggested name.
        Specified by:
        generateColumnAlias in interface DatabaseInterface
        Parameters:
        columnIndex - Index of column in query
        suggestedName - Suggested column name
        Returns:
        Column alias that is valid for this database
      • parseStatements

        public List<String> parseStatements​(String sqlScript)
        Parse all possible statements from the provided SQL script.
        Specified by:
        parseStatements in interface DatabaseInterface
        Parameters:
        sqlScript - Raw SQL Script to be parsed into executable statements.
        Returns:
        List of parsed SQL statements to be executed separately.
      • getSqlScriptStatements

        public List<SqlScriptStatement> getSqlScriptStatements​(String sqlScript)
        Parse the statements in the provided SQL script, provide more information about where each was found in the script.
        Specified by:
        getSqlScriptStatements in interface DatabaseInterface
        Parameters:
        sqlScript - Raw SQL Script to be parsed into executable statements.
        Returns:
        List of SQL script statements to be executed separately.
      • onlySpaces

        protected boolean onlySpaces​(String str)
        Parameters:
        str -
        Returns:
        True if str contains only spaces.
      • isMySQLVariant

        public boolean isMySQLVariant()
        Specified by:
        isMySQLVariant in interface DatabaseInterface
        Returns:
        true if the database is a MySQL variant, like MySQL 5.1, InfiniDB, InfoBright, and so on.
      • canTest

        public boolean canTest()
        Returns:
        true if the database type can be tested against a database instance
      • requiresName

        public boolean requiresName()
        Returns:
        true if the database name is a required parameter
      • releaseSavepoint

        public boolean releaseSavepoint()
        Returns a true of savepoints can be released, false if not.
        Specified by:
        releaseSavepoint in interface DatabaseInterface
        Returns:
      • getDataTablespaceDDL

        public String getDataTablespaceDDL​(VariableSpace variables,
                                           DatabaseMeta databaseMeta)
        Returns the tablespace DDL fragment for a "Data" tablespace. In most databases that use tablespaces this is where the tables are to be created.
        Specified by:
        getDataTablespaceDDL in interface DatabaseInterface
        Parameters:
        variables - variables used for possible substitution
        databaseMeta - databaseMeta the database meta used for possible string enclosure of the tablespace. This method needs this as this is done after environmental substitution.
        Returns:
        String the tablespace name for tables in the format "tablespace TABLESPACE_NAME". The TABLESPACE_NAME and the passed DatabaseMata determines if TABLESPACE_NAME is to be enclosed in quotes.
      • getIndexTablespaceDDL

        public String getIndexTablespaceDDL​(VariableSpace variables,
                                            DatabaseMeta databaseMeta)
        Returns the tablespace DDL fragment for a "Index" tablespace.
        Specified by:
        getIndexTablespaceDDL in interface DatabaseInterface
        Parameters:
        variables - variables used for possible substitution
        databaseMeta - databaseMeta the database meta used for possible string enclosure of the tablespace. This method needs this as this is done after environmental substitution.
        Returns:
        String the tablespace name for indices in the format "tablespace TABLESPACE_NAME". The TABLESPACE_NAME and the passed DatabaseMata determines if TABLESPACE_NAME is to be enclosed in quotes.
      • getTablespaceDDL

        public String getTablespaceDDL​(VariableSpace variables,
                                       DatabaseMeta databaseMeta,
                                       String tablespaceName)
        Returns an empty string as most databases do not support tablespaces. Subclasses can override this method to generate the DDL.
        Parameters:
        variables - variables needed for variable substitution.
        databaseMeta - databaseMeta needed for it's quoteField method. Since we are doing variable substitution we need to meta so that we can act on the variable substitution first and then the creation of the entire string that will be retuned.
        tablespaceName - tablespaceName name of the tablespace.
        Returns:
        String an empty String as most databases do not use tablespaces.
      • getValueFromResultSet

        public Object getValueFromResultSet​(ResultSet rs,
                                            ValueMetaInterface val,
                                            int i)
                                     throws KettleDatabaseException
        This method allows a database dialect to convert database specific data types to Kettle data types.
        Specified by:
        getValueFromResultSet in interface DatabaseInterface
        Parameters:
        rs - The result set to use
        val - The description of the value to retrieve
        i - the index on which we need to retrieve the value, 0-based.
        Returns:
        The correctly converted Kettle data type corresponding to the valueMeta description.
        Throws:
        KettleDatabaseException
      • useSafePoints

        public boolean useSafePoints()
        Specified by:
        useSafePoints in interface DatabaseInterface
        Returns:
        true if the database supports the use of safe-points and if it is appropriate to ever use it (default to false)
      • supportsErrorHandling

        public boolean supportsErrorHandling()
        Specified by:
        supportsErrorHandling in interface DatabaseInterface
        Returns:
        true if the database supports error handling (the default). Returns false for certain databases (SQLite) that invalidate a prepared statement or even the complete connection when an error occurs.
      • getSQLValue

        public String getSQLValue​(ValueMetaInterface valueMeta,
                                  Object valueData,
                                  String dateFormat)
                           throws KettleValueException
        Description copied from interface: DatabaseInterface
        Convert a value in the SQL equivalent. For example, convert String "Pentaho" into 'Pentaho' or into Oracle date format TO_DATE('2012/08/16 15:36:59', 'YYYY/MM/DD HH24:MI:SS')
        Specified by:
        getSQLValue in interface DatabaseInterface
        Parameters:
        valueMeta - The description of the value. The date format used is taken from this value unless dateFormat is specified (not null or empty)
        valueData - The data to convert.
        Returns:
        The value SQL clause
        Throws:
        KettleValueException - in case there is a data conversion error.
      • getFieldnameProtector

        protected String getFieldnameProtector()
      • getSafeFieldname

        public String getSafeFieldname​(String fieldName)
        Sanitize a string for usage as a field name
        • Append an underscore to any field name that matches a reserved word
        • Replaces spaces with underscores
        • Prefixes a string with underscore that begins with a number
        Specified by:
        getSafeFieldname in interface DatabaseInterface
        Parameters:
        fieldName - value to sanitize
        Returns:
      • getCreateTableStatement

        public String getCreateTableStatement()
        Customizes the ValueMetaInterface defined in the base
        Specified by:
        getCreateTableStatement in interface DatabaseInterface
        Returns:
        String the create table statement
      • getDropTableIfExistsStatement

        public String getDropTableIfExistsStatement​(String tableName)
        Forms drop table statement. This standard construct syntax is not legal for certain RDBMSs, and should be overridden according to their specifics.
        Specified by:
        getDropTableIfExistsStatement in interface DatabaseInterfaceExtended
        Parameters:
        tableName - Name of the table to drop
        Returns:
        Standard drop table statement
      • fullExceptionLog

        public boolean fullExceptionLog​(Exception e)
        Description copied from interface: DatabaseInterfaceExtended
        Returns false if exception doesn't require full exception log. Could be used in cases of DB vendor specific error which doesn't require stack trace log.
        Specified by:
        fullExceptionLog in interface DatabaseInterfaceExtended
        Parameters:
        e - exception to check
        Returns:
        decision result
      • addAttribute

        public void addAttribute​(String attributeId,
                                 String value)
        Description copied from interface: DatabaseInterface
        Add extra attribute on this connection
        Specified by:
        addAttribute in interface DatabaseInterface
        Parameters:
        attributeId - the attribute identifier
        value - the value of the attribute
      • getAttribute

        public String getAttribute​(String attributeId,
                                   String defaultValue)
        Description copied from interface: DatabaseInterface
        Gets an attribute from the connection
        Specified by:
        getAttribute in interface DatabaseInterface
        Parameters:
        attributeId - the attribute identifier
        defaultValue - the default value in case the attribute is not found
        Returns:
        the attribute value
      • setNamedCluster

        public void setNamedCluster​(String namedCluster)
        Description copied from interface: DatabaseInterface
        Set the hadoop cluster associated with the connection
        Specified by:
        setNamedCluster in interface DatabaseInterface
        Parameters:
        namedCluster - The hadoop cluster name