Interface DatabaseInterface

All Superinterfaces:
Cloneable
All Known Subinterfaces:
DatabaseInterfaceExtended
All Known Implementing Classes:
AS400DatabaseMeta, AthenaDatabaseMeta, AzureSqlDataBaseMeta, BaseDatabaseMeta, CacheDatabaseMeta, DatabricksDatabaseMeta, DB2DatabaseMeta, DbaseDatabaseMeta, DerbyDatabaseMeta, Exasol4DatabaseMeta, ExtenDBDatabaseMeta, FirebirdDatabaseMeta, GenericDatabaseMeta, GoogleBigQueryDatabaseMeta, GreenplumDatabaseMeta, GuptaDatabaseMeta, H2DatabaseMeta, HypersonicDatabaseMeta, InfiniDbDatabaseMeta, InfobrightDatabaseMeta, InformixDatabaseMeta, IngresDatabaseMeta, InterbaseDatabaseMeta, KingbaseESDatabaseMeta, LucidDBDatabaseMeta, MariaDBDatabaseMeta, MondrianNativeDatabaseMeta, MonetDBDatabaseMeta, MSAccessDatabaseMeta, MSSQLServerDatabaseMeta, MSSQLServerNativeDatabaseMeta, MySQLDatabaseMeta, NeoviewDatabaseMeta, NetezzaDatabaseMeta, OracleDatabaseMeta, OracleRDBDatabaseMeta, PostgreSQLDatabaseMeta, RedshiftDatabaseMeta, RemedyActionRequestSystemDatabaseMeta, SAPDBDatabaseMeta, SnowflakeHVDatabaseMeta, SQLiteDatabaseMeta, SybaseDatabaseMeta, SybaseIQDatabaseMeta, TeradataDatabaseMeta, UniVerseDatabaseMeta, VectorWiseDatabaseMeta, Vertica5DatabaseMeta, VerticaDatabaseMeta

public interface DatabaseInterface extends Cloneable
This interface describes the methods that a database connection needs to have in order to describe it properly.
Since:
11-mrt-2005
Author:
Matt
  • Method Details

    • getPluginId

      String getPluginId()
      Returns:
      the plugin id of this database
    • setPluginId

      void setPluginId(String pluginId)
      Parameters:
      pluginId - set the plugin id of this plugin (after instantiation)
    • getPluginName

      String getPluginName()
      Returns:
      the plugin name of this database, the same thing as the annotation typeDescription
    • setPluginName

      void setPluginName(String pluginName)
      Parameters:
      pluginName - set the plugin name of this plugin (after instantiation)
    • getAccessType

      int getAccessType()
      Returns:
      Returns the accessType.
    • setAccessType

      void setAccessType(int accessType)
      Parameters:
      accessType - The accessType to set.
    • isChanged

      boolean isChanged()
      Returns:
      Returns the changed.
    • setChanged

      void setChanged(boolean changed)
      Parameters:
      changed - The changed to set.
    • getName

      String getName()
      Returns:
      Returns the connection Name.
    • setName

      void setName(String name)
      Parameters:
      name - The connection Name to set.
    • getDisplayName

      String getDisplayName()
      Returns:
      Returns the un-escaped connection Name.
    • setDisplayName

      void setDisplayName(String displayName)
      Parameters:
      displayName - The un-escaped connection Name to set.
    • getDatabaseName

      String getDatabaseName()
      Returns:
      Returns the databaseName.
    • setDatabaseName

      void setDatabaseName(String databaseName)
      Parameters:
      databaseName - The databaseName to set.
    • getDatabasePortNumberString

      String getDatabasePortNumberString()
      Returns:
      Returns the databasePortNumber as a string.
    • setDatabasePortNumberString

      void setDatabasePortNumberString(String databasePortNumberString)
      Parameters:
      databasePortNumberString - The databasePortNumber to set as a string.
    • getHostname

      String getHostname()
      Returns:
      Returns the hostname.
    • setHostname

      void setHostname(String hostname)
      Parameters:
      hostname - The hostname to set.
    • getObjectId

      ObjectId getObjectId()
      Returns:
      Returns the id.
    • setObjectId

      void setObjectId(ObjectId id)
      Parameters:
      id - The id to set.
    • getUsername

      String getUsername()
      Returns:
      the username to log onto the database
    • setUsername

      void setUsername(String username)
      Parameters:
      username - Sets the username to log onto the database with.
    • getPassword

      String getPassword()
      Returns:
      Returns the password.
    • setPassword

      void setPassword(String password)
      Parameters:
      password - The password to set.
    • getServername

      String getServername()
      Returns:
      Returns the servername.
    • setServername

      void setServername(String servername)
      Parameters:
      servername - The servername to set.
    • getDataTablespace

      String getDataTablespace()
      Returns:
      the tablespace to store data in. (create table)
    • setDataTablespace

      void setDataTablespace(String dataTablespace)
      Parameters:
      dataTablespace - the tablespace to store data in
    • getIndexTablespace

      String getIndexTablespace()
      Returns:
      the tablespace to store indexes in
    • setIndexTablespace

      void setIndexTablespace(String indexTablespace)
      Parameters:
      indexTablespace - the tablespace to store indexes in
    • getAttributes

      Properties getAttributes()
      Returns:
      The extra attributes for this database connection
    • setAttributes

      void setAttributes(Properties attributes)
      Set extra attributes on this database connection
      Parameters:
      attributes - The extra attributes to set on this database connection.
    • addAttribute

      default void addAttribute(String attributeId, String value)
      Add extra attribute on this connection
      Parameters:
      attributeId - the attribute identifier
      value - the value of the attribute
    • getAttribute

      default String getAttribute(String attributeId, String defaultValue)
      Gets an attribute from the connection
      Parameters:
      attributeId - the attribute identifier
      defaultValue - the default value in case the attribute is not found
      Returns:
      the attribute value
    • supportsSetCharacterStream

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

      boolean supportsAutoInc()
      Returns:
      Whether or not the database can use auto increment type of fields (pk)
    • getFieldDefinition

      String getFieldDefinition(ValueMetaInterface v, String tk, String pk, boolean useAutoinc, boolean addFieldName, boolean addCr)
      Describe a Value as a field in the database.
      Parameters:
      v - The value to describe
      tk - The field that's going to be the technical key
      pk - The field that's going to be the primary key
      useAutoinc - Use autoincrement or not
      addFieldName - Add the fieldname to the definition or not
      addCr - Add a cariage return at the end of the definition or not.
      Returns:
      a value described as a field in this database.
    • getAccessTypeList

      int[] getAccessTypeList()
      Get the list of possible access types for a database.
      Returns:
      the list of possible access types for a database.
    • getDefaultDatabasePort

      int getDefaultDatabasePort()
      Returns:
      the default database port number
    • getDefaultOptions

      Map<String,String> getDefaultOptions()
      Returns:
      default extra Options
    • getLimitClause

      String getLimitClause(int nrRows)
      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
    • getSQLQueryFields

      String getSQLQueryFields(String tableName)
      Returns the minimal SQL to launch in order to determine the layout of the resultset for a given database table
      Parameters:
      tableName - The name of the table to determine the layout for
      Returns:
      The SQL to launch.
    • getNotFoundTK

      int getNotFoundTK(boolean useAutoinc)
      Get the not found technical key.
      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.
    • getDriverClass

      String getDriverClass()
      Obtain the name of the JDBC driver class that we need to use!
      Returns:
      the name of the JDBC driver class for the specific database
    • getURL

      String getURL(String hostname, String port, String databaseName) throws KettleDatabaseException
      Parameters:
      hostname - the hostname
      port - the port as a string
      databaseName - the database name
      Returns:
      the URL to use for connecting to the database.
      Throws:
      KettleDatabaseException - in case a configuration error is detected.
    • supportsSequences

      boolean supportsSequences()
      Returns:
      true if the database supports sequences
    • getSQLNextSequenceValue

      String getSQLNextSequenceValue(String sequenceName)
      Get the SQL to get the next value of a sequence.
      Parameters:
      sequenceName - The sequence name
      Returns:
      the SQL to get the next value of a sequence.
    • getSQLCurrentSequenceValue

      String getSQLCurrentSequenceValue(String sequenceName)
      Get the current value of a database sequence
      Parameters:
      sequenceName - The sequence to check
      Returns:
      The current value of a database sequence
    • getSQLSequenceExists

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

      boolean isFetchSizeSupported()
      Checks whether or not the command setFetchSize() is supported by the JDBC driver...
      Returns:
      true is setFetchSize() is supported!
    • supportsTransactions

      boolean supportsTransactions()
      Returns:
      true if the database supports transactions.
    • supportsBitmapIndex

      boolean supportsBitmapIndex()
      Returns:
      true if the database supports bitmap indexes
    • supportsIndexes

      default boolean supportsIndexes()
      Returns:
      true if the database supports indexes at all. (Exasol and Snowflake do not)
    • supportsSetLong

      boolean supportsSetLong()
      Returns:
      true if the database JDBC driver supports the setLong command
    • supportsSchemas

      boolean supportsSchemas()
      Returns:
      true if the database supports schemas
    • supportsCatalogs

      boolean supportsCatalogs()
      Returns:
      true if the database supports catalogs
    • supportsEmptyTransactions

      boolean supportsEmptyTransactions()
      Returns:
      true when the database engine supports empty transaction. (for example Informix does not!)
    • needsPlaceHolder

      boolean needsPlaceHolder()
      Indicates the need to insert a placeholder (0) for auto increment fields.
      Returns:
      true if we need a placeholder for auto increment fields in insert statements.
    • getFunctionSum

      String getFunctionSum()
      Returns:
      the function for Sum agrregate
    • getFunctionAverage

      String getFunctionAverage()
      Returns:
      the function for Average agrregate
    • getFunctionMinimum

      String getFunctionMinimum()
      Returns:
      the function for Minimum agrregate
    • getFunctionMaximum

      String getFunctionMaximum()
      Returns:
      the function for Maximum agrregate
    • getFunctionCount

      String getFunctionCount()
      Returns:
      the function for Count agrregate
    • getSchemaTableCombination

      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...
      Parameters:
      schemaName - The schema name
      tablePart - The tablename
      Returns:
      the schema-table combination to query the right table.
    • getMaxTextFieldLength

      int getMaxTextFieldLength()
      Get the maximum length of a text field for this database connection. This includes optional CLOB, Memo and Text fields. (the maximum!)
      Returns:
      The maximum text field length for this database type. (mostly CLOB_LENGTH)
    • getMaxVARCHARLength

      int getMaxVARCHARLength()
      Get the maximum length of a text field (VARCHAR) for this database connection. If this size is exceeded use a CLOB.
      Returns:
      The maximum VARCHAR field length for this database type. (mostly identical to getMaxTextFieldLength() - CLOB_LENGTH)
    • getAddColumnStatement

      String getAddColumnStatement(String tablename, ValueMetaInterface v, String tk, boolean useAutoinc, String pk, boolean semicolon)
      Generates the SQL statement to add a column to the specified table
      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 add a column to the specified table
    • getDropColumnStatement

      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
      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
    • getModifyColumnStatement

      String getModifyColumnStatement(String tablename, ValueMetaInterface v, String tk, boolean useAutoinc, String pk, boolean semicolon)
      Generates the SQL statement to modify a column in the specified table
      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 modify a column in the specified table
    • clone

      Object clone()
      Clone this database interface: copy all info to a new object
      Returns:
      the cloned Database Interface object.
    • getReservedWords

      String[] getReservedWords()
      Returns:
      an array of reserved words for the database type...
    • quoteReservedWords

      boolean quoteReservedWords()
      Returns:
      true if reserved words need to be double quoted ("password", "select", ...)
    • getStartQuote

      String getStartQuote()
      Returns:
      The start quote sequence, mostly just double quote, but sometimes [, ...
    • getEndQuote

      String getEndQuote()
      Returns:
      The end quote sequence, mostly just double quote, but sometimes ], ...
    • supportsRepository

      boolean supportsRepository()
      Returns:
      true if Kettle can create a repository on this type of database.
    • getTableTypes

      String[] getTableTypes()
      Returns:
      a list of table types to retrieve tables for the database This is mostly just { "TABLE" }
    • getViewTypes

      String[] getViewTypes()
      Returns:
      a list of table types to retrieve views for the database This is mostly just { "VIEW" }
    • getSynonymTypes

      String[] getSynonymTypes()
      Returns:
      a list of table types to retrieve synonyms for the database
    • useSchemaNameForTableList

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

      boolean supportsViews()
      Returns:
      true if the database supports views
    • supportsSynonyms

      boolean supportsSynonyms()
      Returns:
      true if the database supports synonyms
    • getSQLListOfProcedures

      String getSQLListOfProcedures()
      Returns:
      The SQL on this database to get a list of stored procedures.
    • getTruncateTableStatement

      String getTruncateTableStatement(String tableName)
      Parameters:
      tableName - The table to be truncated.
      Returns:
      The SQL statement to truncate a table: remove all rows from it without a transaction
    • supportsFloatRoundingOnUpdate

      boolean supportsFloatRoundingOnUpdate()
      Returns:
      true if the database rounds floating point numbers to the right precision. For example if the target field is number(7,2) the value 12.399999999 is converted into 12.40
    • getSQLLockTables

      String getSQLLockTables(String[] tableNames)
      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.
    • getSQLUnlockTables

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

      boolean supportsTimeStampToDateConversion()
      Returns:
      true if the database resultsets support getTimeStamp() to retrieve date-time. (Date)
    • supportsBatchUpdates

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

      boolean supportsBooleanDataType()
      Returns:
      true if the database supports a boolean, bit, logical, ... datatype
    • setSupportsBooleanDataType

      void setSupportsBooleanDataType(boolean b)
      Parameters:
      b - Set to true if the database supports a boolean, bit, logical, ... datatype
    • preserveReservedCase

      boolean preserveReservedCase()
      Returns:
      true if reserved words' case should be preserved
    • setPreserveReservedCase

      void setPreserveReservedCase(boolean b)
      Parameters:
      b - Set to true if reserved words' case should be preserved
    • isDefaultingToUppercase

      boolean isDefaultingToUppercase()
      Returns:
      true if the database defaults to naming tables and fields in upper case. True for most databases except for stuborn stuff like Postgres ;-)
    • getExtraOptions

      Map<String,String> getExtraOptions()
      Returns:
      a map of all the extra URL options you want to set, retrieved from the attributes list (NOT synchronized!)
    • addExtraOption

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

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

      String getExtraOptionValueSeparator()
      Returns:
      The extra option value separator in database URL for this platform (usually this is the equal sign = )
    • getExtraOptionIndicator

      String getExtraOptionIndicator()
      Returns:
      This indicator separates the normal URL from the options
    • supportsOptionsInURL

      boolean supportsOptionsInURL()
      Returns:
      true if the database supports connection options in the URL, false if they are put in a Properties object.
    • getExtraOptionsHelpText

      String getExtraOptionsHelpText()
      Returns:
      extra help text on the supported options on the selected database platform.
    • supportsGetBlob

      boolean supportsGetBlob()
      Returns:
      true if the database JDBC driver supports getBlob on the resultset. If not we must use getBytes() to get the data.
    • getConnectSQL

      String getConnectSQL()
      Returns:
      The SQL to execute right after connecting
    • setConnectSQL

      void setConnectSQL(String sql)
      Parameters:
      sql - The SQL to execute right after connecting
    • supportsSetMaxRows

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

      boolean isUsingConnectionPool()
      Returns:
      true if we want to use a database connection pool
    • setUsingConnectionPool

      void setUsingConnectionPool(boolean usePool)
      Parameters:
      usePool - true if we want to use a database connection pool
    • getMaximumPoolSize

      int getMaximumPoolSize()
      Returns:
      the maximum pool size
    • getMaximumPoolSizeString

      String getMaximumPoolSizeString()
      Returns:
      the maximum pool size variable name
    • setMaximumPoolSize

      void setMaximumPoolSize(int maximumPoolSize)
      Parameters:
      maximumPoolSize - the maximum pool size
    • setMaximumPoolSizeString

      void setMaximumPoolSizeString(String maximumPoolSize)
      Parameters:
      maximumPoolSize - the maximum pool size variable name
    • getInitialPoolSize

      int getInitialPoolSize()
      Returns:
      the initial pool size
    • getInitialPoolSizeString

      String getInitialPoolSizeString()
      Returns:
      the initial pool size variable name
    • setInitialPoolSize

      void setInitialPoolSize(int initalPoolSize)
      Parameters:
      initalPoolSize - the initial pool size
    • setInitialPoolSizeString

      void setInitialPoolSizeString(String initialPoolSize)
      Parameters:
      initialPoolSize - the initial pool size variable name
    • isPartitioned

      boolean isPartitioned()
      Returns:
      true if the connection contains partitioning information
    • setPartitioned

      void setPartitioned(boolean partitioned)
      Parameters:
      partitioned - true if the connection is set to contain partitioning information
    • getPartitioningInformation

      PartitionDatabaseMeta[] getPartitioningInformation()
      Returns:
      the available partition/host/databases/port combinations in the cluster
    • setPartitioningInformation

      void setPartitioningInformation(PartitionDatabaseMeta[] partitionInfo)
      Parameters:
      partitionInfo - the available partition/host/databases/port combinations in the cluster
    • getUsedLibraries

      String[] getUsedLibraries()
      Returns:
      the required libraries (in lib) for this database connection.
    • getConnectionPoolingProperties

      Properties getConnectionPoolingProperties()
      Returns:
      The set of properties that allows you to set the connection pooling parameters
    • setConnectionPoolingProperties

      void setConnectionPoolingProperties(Properties properties)
      set the connection pooling properties
    • getSQLTableExists

      String getSQLTableExists(String tablename)
      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

      String getSQLColumnExists(String column, String tablename)
      Parameters:
      column - 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

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

      boolean isStreamingResults()
      Returns:
      true if the database is streaming results (normally this is an option just for MySQL).
    • setStreamingResults

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

      boolean isQuoteAllFields()
      Returns:
      true if all fields should always be quoted in db
    • setQuoteAllFields

      void setQuoteAllFields(boolean quoteAllFields)
      Parameters:
      quoteAllFields - true if all fields in DB should be quoted.
    • isForcingIdentifiersToLowerCase

      boolean isForcingIdentifiersToLowerCase()
      Returns:
      true if all identifiers should be forced to lower case
    • setForcingIdentifiersToLowerCase

      void setForcingIdentifiersToLowerCase(boolean forceLowerCase)
      Parameters:
      forceLowerCase - true if all identifiers should be forced to lower case
    • isForcingIdentifiersToUpperCase

      boolean isForcingIdentifiersToUpperCase()
      Returns:
      true if all identifiers should be forced to upper case
    • setForcingIdentifiersToUpperCase

      void setForcingIdentifiersToUpperCase(boolean forceUpperCase)
      Parameters:
      forceUpperCase - true if all identifiers should be forced to upper case
    • isUsingDoubleDecimalAsSchemaTableSeparator

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

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

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

      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.
      Returns:
      the name of the database test factory to use.
    • getPreferredSchemaName

      String getPreferredSchemaName()
      Returns:
      The preferred schema name of this database connection.
    • setPreferredSchemaName

      void setPreferredSchemaName(String preferredSchemaName)
      Parameters:
      preferredSchemaName - The preferred schema name of this database connection.
    • checkIndexExists

      boolean checkIndexExists(Database database, String schemaName, String tableName, String[] idxFields) throws KettleDatabaseException
      Verifies on the specified database connection if an index exists on the fields with the specified name.
      Parameters:
      database -
      schemaName -
      tableName -
      idxFields -
      Returns:
      Throws:
      KettleDatabaseException
    • supportsSequenceNoMaxValueOption

      boolean supportsSequenceNoMaxValueOption()
      Returns:
      true if the database supports sequences with a maximum value option. The default is true.
    • requiresCreateTablePrimaryKeyAppend

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

      boolean requiresCastToVariousForIsNull()
      Returns:
      true if the database requires you to cast a parameter to varchar before comparing to null.
    • isDisplaySizeTwiceThePrecision

      boolean isDisplaySizeTwiceThePrecision()
      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

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

      boolean isSystemTable(String tableName)
      Parameters:
      tableName -
      Returns:
      true if the specified table is a system table
    • supportsNewLinesInSQL

      boolean supportsNewLinesInSQL()
      Returns:
      true if the database supports newlines in a SQL statements.
    • getSQLListOfSchemas

      String getSQLListOfSchemas()
      Returns:
      the SQL to retrieve the list of schemas
    • getSQLListOfSchemas

      default String getSQLListOfSchemas(DatabaseMeta dbMeta)
      Parameters:
      dbMeta -
      Returns:
      the SQL to retrieve the list of schemas
    • getMaxColumnsInIndex

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

      boolean supportsErrorHandlingOnBatchUpdates()
      Returns:
      true if the database supports error handling (recovery of failure) while doing batch updates.
    • getSQLInsertAutoIncUnknownDimensionRow

      String getSQLInsertAutoIncUnknownDimensionRow(String schemaTable, String keyField, String versionField)
      Get the SQL to insert a new empty unknown record in a dimension.
      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

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

      String getXulOverlayFile()
      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.
    • getSQLListOfSequences

      String getSQLListOfSequences()
      Returns:
      The SQL on this database to get a list of sequences.
    • quoteSQLString

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

      String getSelectCountStatement(String tableName)
      Returns the SQL Statement that counts the number of rows in the table.
      Parameters:
      tableName -
      Returns:
    • generateColumnAlias

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

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

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

      boolean isMySQLVariant()
      Returns:
      true if the database is a MySQL variant, like MySQL 5.1, InfiniDB, InfoBright, and so on.
    • releaseSavepoint

      boolean releaseSavepoint()
      Returns a true of savepoints can be release, false if not.
      Returns:
    • getNextBatchId

      Long getNextBatchId(DatabaseMeta dbm, Database ldb, String schemaName, String tableName, String fieldName) throws KettleDatabaseException
      Get the next Batch ID from the logging tables.
      Parameters:
      dbm - DatabaseMeta object
      ldb - Database connection
      schemaName - Logging Schema Name
      tableName - Logging Table Name
      fieldName - Batch Id Field name
      Returns:
      next batch ID
      Throws:
      KettleDatabaseException
    • getDataTablespaceDDL

      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.
      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

      String getIndexTablespaceDDL(VariableSpace variables, DatabaseMeta databaseMeta)
      Returns the tablespace DDL fragment for a "Index" tablespace.
      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 indicis in the format "tablespace TABLESPACE_NAME". The TABLESPACE_NAME and the passed DatabaseMata determines if TABLESPACE_NAME is to be enclosed in quotes.
    • getValueFromResultSet

      Object getValueFromResultSet(ResultSet resultSet, ValueMetaInterface valueMeta, int index) throws KettleDatabaseException
      This method allows a database dialect to convert database specific data types to Kettle data types.
      Parameters:
      resultSet - The result set to use
      valueMeta - The description of the value to retrieve
      index - 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

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

      boolean supportsErrorHandling()
      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

      String getSQLValue(ValueMetaInterface valueMeta, Object valueData, String dateFormat) throws KettleValueException
      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')
      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.
    • supportsResultSetMetadataRetrievalOnly

      boolean supportsResultSetMetadataRetrievalOnly()
      Returns:
      true if this database only supports metadata retrieval on a result set, never on a statement (even if the statement has been executed)
    • supportsTimestampDataType

      boolean supportsTimestampDataType()
      Returns:
      true if the database supports the Timestamp data type (nanosecond precision and all)
    • setSupportsTimestampDataType

      void setSupportsTimestampDataType(boolean b)
      Parameters:
      b - Set to true if the database supports the Timestamp data type (nanosecond precision and all)
    • getSafeFieldname

      String getSafeFieldname(String fieldName)
      Given a String, this will sanitize and return a value safe for usage as a column name
      Parameters:
      fieldName - value to sanitize
      Returns:
      a String safe for usage as a column name without the need for quoting
    • getSequenceNoMaxValueOption

      String getSequenceNoMaxValueOption()
      Returns:
      true if the database supports sequences with a maximum value option. The default is true.
    • supportsAutoGeneratedKeys

      boolean supportsAutoGeneratedKeys()
      Returns:
      true if the database supports autoGeneratedKeys
    • customizeValueFromSQLType

      ValueMetaInterface customizeValueFromSQLType(ValueMetaInterface v, ResultSetMetaData rm, int index) throws SQLException
      Customizes the ValueMetaInterface defined in the base
      Parameters:
      v - the determined valueMetaInterface
      rm - the sql column type
      index - the index to the column to customize
      Returns:
      ValueMetaInterface customized with the data base specific types
      Throws:
      SQLException
    • getCreateTableStatement

      String getCreateTableStatement()
      Customizes the ValueMetaInterface defined in the base
      Returns:
      String the create table statement
    • addDefaultOptions

      @Deprecated default void addDefaultOptions()
      Deprecated.
      No longer works with the UI, Use getDefaultOptions, instead
      Set default options for this database
    • createSqlScriptParser

      default SqlScriptParser createSqlScriptParser()
      Create SqlScriptParser for current database dialect
      Returns:
      instance of SqlScriptParser for current database dialect
    • supportsStandardTableOutput

      default boolean supportsStandardTableOutput()
      Returns:
      true if database supports the standard table output step
    • getUnsupportedTableOutputMessage

      default String getUnsupportedTableOutputMessage()
      Returns:
      the unsupported message if database does not support standard table output step
    • getLegacyColumnName

      default String getLegacyColumnName(DatabaseMetaData dbMetaData, ResultSetMetaData rsMetaData, int index) throws KettleDatabaseException
      Allows to get the column name for JDBC drivers with different behavior for aliases depending on the connector version.
      Parameters:
      dbMetaData -
      rsMetaData -
      index -
      Returns:
      empty if the database doesn't support the legacy column name feature
      Throws:
      KettleDatabaseException
    • putOptionalOptions

      default void putOptionalOptions(Map<String,String> extraOptions)
    • getSchemas

      default ResultSet getSchemas(DatabaseMetaData databaseMetaData, DatabaseMeta dbMeta) throws SQLException
      Throws:
      SQLException
    • getTables

      default ResultSet getTables(DatabaseMetaData databaseMetaData, DatabaseMeta dbMeta, String schemaPattern, String tableNamePattern, String[] tableTypes) throws SQLException
      Throws:
      SQLException
    • getNamedCluster

      default String getNamedCluster()
      Returns:
      The hadoop cluster associated with the connection
    • setNamedCluster

      default void setNamedCluster(String namedCluster)
      Set the hadoop cluster associated with the connection
      Parameters:
      namedCluster - The hadoop cluster name
    • getNamedClusterList

      default List<String> getNamedClusterList()