Package org.pentaho.di.core.database
Class DatabaseMeta
- java.lang.Object
-
- org.pentaho.di.shared.SharedObjectBase
-
- org.pentaho.di.core.database.DatabaseMeta
-
- All Implemented Interfaces:
Cloneable,VariableSpace,XMLInterface,RepositoryElementInterface,RepositoryObjectInterface,SharedObjectInterface
public class DatabaseMeta extends SharedObjectBase implements Cloneable, XMLInterface, SharedObjectInterface, VariableSpace, RepositoryElementInterface
This class defines the database specific parameters for a certain database type. It also provides static information regarding a number of well known databases.- Since:
- 18-05-2003
- Author:
- Matt
-
-
Field Summary
Fields Modifier and Type Field Description static intCLOB_LENGTHUse this length in a String value to indicate that you want to use a CLOB in stead of a normal text field.static Comparator<DatabaseMeta>comparatorstatic String[]dbAccessTypeCodeShort description of the access type, used in XML and the repository.static String[]dbAccessTypeDescLonger description for user interactions.static StringEMPTY_OPTIONS_STRINGThe value to store in the attributes so that an empty value doesn't get lost...static RepositoryObjectTypeREPOSITORY_ELEMENT_TYPEstatic intTYPE_ACCESS_JNDIConnect to the database using JNDI.static intTYPE_ACCESS_NATIVEConnect natively through JDBC thin driver to the database.static intTYPE_ACCESS_OCIConnect to the database using OCI.static intTYPE_ACCESS_ODBCConnect to the database using ODBC.static intTYPE_ACCESS_PLUGINConnect to the database using plugin specific method.static intTYPE_DATABASE_ACCESSDeprecated.static intTYPE_DATABASE_AS400Deprecated.static intTYPE_DATABASE_CACHEDeprecated.static intTYPE_DATABASE_DB2Deprecated.static intTYPE_DATABASE_DBASEDeprecated.static intTYPE_DATABASE_DERBYDeprecated.static intTYPE_DATABASE_EXTENDBDeprecated.static intTYPE_DATABASE_FIREBIRDDeprecated.static intTYPE_DATABASE_GENERICDeprecated.static intTYPE_DATABASE_GREENPLUMDeprecated.static intTYPE_DATABASE_GUPTADeprecated.static intTYPE_DATABASE_H2Deprecated.static intTYPE_DATABASE_HYPERSONICDeprecated.static intTYPE_DATABASE_INFOBRIGHTDeprecated.static intTYPE_DATABASE_INFORMIXDeprecated.static intTYPE_DATABASE_INGRESDeprecated.static intTYPE_DATABASE_INTERBASEDeprecated.static intTYPE_DATABASE_KINGBASEESDeprecated.static intTYPE_DATABASE_LUCIDDBDeprecated.static intTYPE_DATABASE_MONETDBDeprecated.static intTYPE_DATABASE_MSSQLDeprecated.static intTYPE_DATABASE_MYSQLDeprecated.static intTYPE_DATABASE_NEOVIEWDeprecated.static intTYPE_DATABASE_NETEZZADeprecated.static intTYPE_DATABASE_NONEDeprecated.static intTYPE_DATABASE_ORACLEDeprecated.static intTYPE_DATABASE_ORACLE_RDBDeprecated.static intTYPE_DATABASE_PALODeprecated.static intTYPE_DATABASE_POSTGRESDeprecated.static intTYPE_DATABASE_REMEDY_AR_SYSTEMDeprecated.static intTYPE_DATABASE_SAPDBDeprecated.static intTYPE_DATABASE_SAPR3Deprecated.static intTYPE_DATABASE_SQLITEDeprecated.static intTYPE_DATABASE_SYBASEDeprecated.static intTYPE_DATABASE_SYBASEIQDeprecated.static intTYPE_DATABASE_TERADATADeprecated.static intTYPE_DATABASE_UNIVERSEDeprecated.static intTYPE_DATABASE_VERTICADeprecated.static StringXML_TAG
-
Constructor Summary
Constructors Constructor Description DatabaseMeta()Create an empty database connectionDatabaseMeta(String xml)Constructs a new database using an XML string snippet.DatabaseMeta(String name, String type, String access, String host, String db, String port, String user, String pass)Construct a new database connections.DatabaseMeta(Node con)Reads the information from an XML Node into this new database connection.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddExtraOption(String databaseTypeCode, String option, String value)Add an extra option to the attributes listvoidaddOptions()Add a list of common options for some databases.protected StringappendExtraOptions(String url, Map<String,String> extraOptions)voidapplyDefaultOptions(DatabaseInterface databaseInterface)String[]checkParameters()Check the database connection parameters and give back an array of remarksvoidclearChanged()static voidclearDatabaseInterfacesMap()Clear the database interfaces map.Objectclone()voidcopyVariablesFrom(VariableSpace space)Copy the variables from another space, without initializing with the defaults.protected booleandatabaseForBothDbInterfacesIsTheSame(DatabaseInterface primary, DatabaseInterface secondary)This method is designed to identify whether the actual database for two database connection types is the same.ObjectdeepClone(boolean cloneUpdateFlag)StringenvironmentSubstitute(String aString)Substitute the string using the current variable space.String[]environmentSubstitute(String[] aString)Replaces environment variables in an array of strings.booleanequals(Object obj)StringfieldSubstitute(String aString, RowMetaInterface rowMeta, Object[] rowData)Substitutes field values inaString.static DatabaseMetafindDatabase(List<? extends SharedObjectInterface> databases, String dbname)Find a database with a certain name in an arraylist of databases.static DatabaseMetafindDatabase(List<DatabaseMeta> databases, ObjectId id)Find a database with a certain ID in an arraylist of databases.StringgenerateColumnAlias(int columnIndex, String suggestedName)intgetAccessType()Return the type of database access.static intgetAccessType(String dbaccess)StringgetAccessTypeDesc()Gets you a short description of the type of database access.static StringgetAccessTypeDesc(int dbaccess)static StringgetAccessTypeDescLong(int dbaccess)static int[]getAccessTypeList(String dbTypeDesc)StringgetAddColumnStatement(String tablename, ValueMetaInterface v, String tk, boolean use_autoinc, String pk, boolean semicolon)PropertiesgetAttributes()booleangetBooleanValueOfVariable(String variableName, boolean defaultValue)This method returns a boolean for the new variable check boxes.PropertiesgetConnectionPoolingProperties()PropertiesgetConnectionProperties()StringgetConnectSQL()StringgetCreateTableStatement()Customizes the ValueMetaInterface defined in the baseDatabaseFactoryInterfacegetDatabaseFactory()DatabaseInterfacegetDatabaseInterface()static DatabaseInterfacegetDatabaseInterface(String databaseType)Search for the right type of DatabaseInterface object and clone it.static DatabaseInterface[]getDatabaseInterfaces()static Map<String,DatabaseInterface>getDatabaseInterfacesMap()StringgetDatabaseName()Return the name of the database.StringgetDatabasePortNumberString()Return the port on which the database listens as a String.StringgetDatabaseTypeDesc()Deprecated.This is actually the plugin IDStringgetDataTablespace()protected DatabaseInterfacegetDbInterface(String typeCode)For testingintgetDefaultDatabasePort()StringgetDescription()Gets the description of the repository object.StringgetDisplayName()Returns the name of the database connectionStringgetDriverClass()StringgetDropColumnStatement(String tablename, ValueMetaInterface v, String tk, boolean use_autoinc, String pk, boolean semicolon)StringgetDropTableIfExistsStatement(String tableName)Forms the drop table statement specific for a certain RDBMS.StringgetEndQuote()StringgetExtraOptionIndicator()Map<String,String>getExtraOptions()StringgetExtraOptionSeparator()StringgetExtraOptionsHelpText()StringgetExtraOptionValueSeparator()List<RowMetaAndData>getFeatureSummary()StringgetFieldDefinition(ValueMetaInterface v, String tk, String pk, boolean use_autoinc)StringgetFieldDefinition(ValueMetaInterface v, String tk, String pk, boolean use_autoinc, boolean add_fieldname, boolean add_cr)StringgetFunctionAverage()StringgetFunctionCount()StringgetFunctionMaximum()StringgetFunctionMinimum()StringgetFunctionSum()protected LogChannelInterfacegetGeneralLogger()For testingStringgetHostname()Return the hostname of the machine on which the database runs.StringgetIndexTablespace()intgetInitialPoolSize()StringgetInitialPoolSizeString()StringgetLimitClause(int nrRows)intgetMaxColumnsInIndex()intgetMaximumPoolSize()StringgetMaximumPoolSizeString()intgetMaxTextFieldLength()Get the maximum length of a text field for this database connection.StringgetModifyColumnStatement(String tablename, ValueMetaInterface v, String tk, boolean use_autoinc, String pk, boolean semicolon)StringgetName()Returns the name of the database connectionStringgetNamedCluster()LonggetNextBatchId(Database ldb, String schemaName, String tableName, String fieldName)intgetNotFoundTK(boolean use_autoinc)intgetNrReservedWords(RowMetaInterface fields)Checks the fields specified for reserved wordsObjectIdgetObjectId()Returns the database ID of this database connection if a repository was used before.ObjectRevisiongetObjectRevision()Gets the object revision.VariableSpacegetParentVariableSpace()Get the parent of the variable space.PartitionDatabaseMeta[]getPartitioningInformation()PartitionDatabaseMetagetPartitionMeta(String partitionId)Finds the partition metadata for the given partition iDStringgetPassword()Get the password to log into the database on this connection.StringgetPluginId()The plugin ID of the database interfacestatic intgetPortForDBType(String strtype, String straccess)StringgetPreferredSchemaName()StringgetQuotedSchemaTableCombination(String schemaName, String tableName)Calculate the schema-table combination, usually this is the schema and table separated with a dot.RepositoryDirectoryInterfacegetRepositoryDirectory()Not used in this case, simply return root /RepositoryObjectTypegetRepositoryElementType()Gets the repository element type for this object.String[]getReservedWords()ResultSetgetSchemas(DatabaseMetaData databaseMetaData)StringgetSchemaTableCombination(String schemaName, String tableName)Deprecated.please use getQuotedSchemaTableCombination()StringgetSeqNextvalSQL(String sequenceName)StringgetSequenceNoMaxValueOption()StringgetServername()StringgetSQLColumnExists(String columnname, String tablename)StringgetSQLCurrentSequenceValue(String sequenceName)StringgetSQLInsertAutoIncUnknownDimensionRow(String schemaTable, String keyField, String versionField)Get the SQL to insert a new empty unknown record in a dimension.StringgetSQLListOfProcedures()StringgetSQLListOfSchemas()StringgetSQLListOfSequences()StringgetSQLLockTables(String[] tableNames)StringgetSQLQueryFields(String tableName)StringgetSQLSequenceExists(String sequenceName)StringgetSQLServerInstance()StringgetSQLTableExists(String tablename)StringgetSQLUnlockTables(String[] tableNames)StringgetStartQuote()String[]getSynonymTypes()ResultSetgetTables(DatabaseMetaData databaseMetaData, String schema, String table, String[] tableTypesToGet)String[]getTableTypes()StringgetTruncateTableStatement(String schema, String tableName)StringgetURL()StringgetURL(String partitionId)StringgetUsername()Get the username to log into the database on this connection.ObjectgetValueFromResultSet(ResultSet rs, ValueMetaInterface val, int i)StringgetVariable(String variableName)Get the value of a variable.StringgetVariable(String variableName, String defaultValue)Get the value of a variable with a default in case the variable is not found.String[]getViewTypes()StringgetXML()Describes the Object implementing this interface as XMLbooleanhasChanged()booleanhasDotInField(String fieldname)inthashCode()booleanhasSpacesInField(String fieldname)Detects if a field has spaces in the name.booleanhasSpecialCharInField(String fieldname)Detects if a field has spaces in the name.static intindexOfName(String[] databaseNames, String name)static voidinit()voidinitializeVariablesFrom(VariableSpace parent)Initialize variable space using the defaults, copy over the variables from the parent (using copyVariablesFrom()), after this the "injected" variables should be inserted (injectVariables()).voidinjectVariables(Map<String,String> prop)Inject variables.booleanisClob(ValueMetaInterface v)booleanisDisplaySizeTwiceThePrecision()booleanisExplorable()booleanisFetchSizeSupported()booleanisForcingIdentifiersToLowerCase()booleanisForcingIdentifiersToUpperCase()booleanisInNeedOfQuoting(String fieldname)Determines whether or not this field is in need of quoting:
- When the fieldname contains spaces
- When the fieldname is a reserved wordbooleanisMySQLVariant()booleanisNeedUpdate()booleanisPartitioned()booleanisQuoteAllFields()booleanisReadOnly()Marker used to determine if the DatabaseMeta should be allowed to be modified/saved.booleanisRequiringTransactionsOnQueries()booleanisReservedWord(String word)Returns true if the string specified is a reserved word on this database type.booleanisStreamingResults()booleanisSystemTable(String tableName)booleanisUsingConnectionPool()booleanisUsingDoubleDecimalAsSchemaTableSeparator()String[]listVariables()List the variables (not the values) that are currently in the variable space.booleanneedsPlaceHolder()Indicates the need to insert a placeholder (0) for auto increment fields.booleanneedsToLockAllTables()booleanpreserveReservedCase()StringquoteField(String field)Returns a quoted field if this is needed: contains spaces, is a reserved word, ...booleanquoteReservedWords()voidquoteReservedWords(RowMetaInterface fields)Changes the names of the fields to their quoted equivalent if this is neededStringquoteSQLString(String string)voidreplaceMeta(DatabaseMeta databaseMeta)voidreplaceMeta(DatabaseMeta databaseMeta, boolean cloneUpdateFlag)booleanreplaceReservedWords(RowMetaInterface fields)Checks the fields specified for reserved words and quotes them.booleanrequiresCastToVariousForIsNull()booleanrequiresCreateTablePrimaryKeyAppend()voidsetAccessType(int access_type)Set the type of database access.voidsetAttributes(Properties attributes)Set extra attributes on this database connectionvoidsetChanged()voidsetChanged(boolean ch)voidsetConnectionPoolingProperties(Properties properties)voidsetConnectSQL(String sql)voidsetDatabaseInterface(DatabaseInterface databaseInterface)Set the system dependend database interface for this database metadata definitionvoidsetDatabaseType(String type)voidsetDataTablespace(String data_tablespace)voidsetDBName(String databaseName)Set the name of the database.voidsetDBPort(String db_port)Sets the port on which the database listens.voidsetDefault()Set default values for an Oracle database.voidsetDescription(String description)Sets the description of the repository object.voidsetDisplayName(String displayName)voidsetForcingIdentifiersToLowerCase(boolean forceLowerCase)voidsetForcingIdentifiersToUpperCase(boolean forceUpperCase)voidsetHostname(String hostname)Sets the hostname of the machine on which the database runs.voidsetIndexTablespace(String index_tablespace)voidsetInitialPoolSize(int initalPoolSize)voidsetInitialPoolSizeString(String initalPoolSize)voidsetMaximumPoolSize(int maximumPoolSize)voidsetMaximumPoolSizeString(String maximumPoolSize)voidsetName(String name)Sets the name of the database connection.voidsetNamedCluster(String namedCluster)voidsetNeedUpdate(boolean needUpdate)voidsetObjectId(ObjectId id)Sets the database ID in the repository for this object.voidsetObjectRevision(ObjectRevision objectRevision)Sets the object revision.voidsetParentVariableSpace(VariableSpace parent)Set the parent variable spacevoidsetPartitioned(boolean partitioned)voidsetPartitioningInformation(PartitionDatabaseMeta[] partitionInfo)voidsetPassword(String password)Sets the password to log into the database on this connection.voidsetPreferredSchemaName(String preferredSchemaName)voidsetPreserveReservedCase(boolean b)voidsetQuoteAllFields(boolean quoteAllFields)voidsetReadOnly(boolean readOnly)Sets the marker used to determine if the DatabaseMeta should be allowed to be modified/saved.voidsetRepositoryDirectory(RepositoryDirectoryInterface repositoryDirectory)voidsetServername(String servername)voidsetSQLServerInstance(String instanceName)voidsetStreamingResults(boolean useStreaming)voidsetSupportsBooleanDataType(boolean b)voidsetSupportsTimestampDataType(boolean b)voidsetUsername(String username)Sets the username to log into the database on this connection.voidsetUsingConnectionPool(boolean usePool)voidsetUsingDoubleDecimalAsSchemaTableSeparator(boolean useDoubleDecimalSeparator)voidsetValues(String name, String type, String access, String host, String db, String port, String user, String pass)voidsetValues(DatabaseMeta info)voidsetVariable(String variableName, String variableValue)Sets a variable in the Kettle Variables list.voidshareVariablesWith(VariableSpace space)Share a variable space from another variable space.StringstripCR(String sbsql)StringstripCR(StringBuffer sbsql)StringstripCR(StringBuilder sbsql)booleansupportsAutoGeneratedKeys()booleansupportsAutoinc()booleansupportsBatchUpdates()booleansupportsBitmapIndex()booleansupportsBooleanDataType()booleansupportsCatalogs()booleansupportsEmptyTransactions()booleansupportsErrorHandlingOnBatchUpdates()booleansupportsFloatRoundingOnUpdate()booleansupportsGetBlob()booleansupportsOptionsInURL()booleansupportsPreparedStatementMetadataRetrieval()booleansupportsSchemas()booleansupportsSequenceNoMaxValueOption()booleansupportsSequences()booleansupportsSetCharacterStream()See if this database supports the setCharacterStream() method on a PreparedStatement.booleansupportsSetLong()booleansupportsSetMaxRows()booleansupportsSynonyms()booleansupportsTimestampDataType()booleansupportsTimeStampToDateConversion()booleansupportsTransactions()Deprecated.because the same database can support transactions or not.booleansupportsViews()StringtestConnection()DatabaseTestResultstestConnectionSuccess()StringtoString()booleanuseSchemaNameForTableList()StringverifyAndModifyDatabaseName(List<DatabaseMeta> databases, String oldname)Verify the name of the database and if required, change it if it already exists in the list of databases.-
Methods inherited from class org.pentaho.di.shared.SharedObjectBase
getChangedDate, isShared, setChangedDate, setShared
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.pentaho.di.shared.SharedObjectInterface
getChangedDate, isShared, setShared
-
Methods inherited from interface org.pentaho.di.core.variables.VariableSpace
environmentSubstitute
-
-
-
-
Field Detail
-
XML_TAG
public static final String XML_TAG
- See Also:
- Constant Field Values
-
REPOSITORY_ELEMENT_TYPE
public static final RepositoryObjectType REPOSITORY_ELEMENT_TYPE
-
comparator
public static final Comparator<DatabaseMeta> comparator
-
TYPE_DATABASE_NONE
@Deprecated public static final int TYPE_DATABASE_NONE
Deprecated.Indicates that the connections doesn't point to a type of database yet.- See Also:
- Constant Field Values
-
TYPE_DATABASE_MYSQL
@Deprecated public static final int TYPE_DATABASE_MYSQL
Deprecated.Connection to a MySQL database- See Also:
- Constant Field Values
-
TYPE_DATABASE_ORACLE
@Deprecated public static final int TYPE_DATABASE_ORACLE
Deprecated.Connection to an Oracle database- See Also:
- Constant Field Values
-
TYPE_DATABASE_AS400
@Deprecated public static final int TYPE_DATABASE_AS400
Deprecated.Connection to an AS/400 (IBM iSeries) DB400 database- See Also:
- Constant Field Values
-
TYPE_DATABASE_ACCESS
@Deprecated public static final int TYPE_DATABASE_ACCESS
Deprecated.Connection to an Microsoft Access database- See Also:
- Constant Field Values
-
TYPE_DATABASE_MSSQL
@Deprecated public static final int TYPE_DATABASE_MSSQL
Deprecated.Connection to a Microsoft SQL Server database- See Also:
- Constant Field Values
-
TYPE_DATABASE_DB2
@Deprecated public static final int TYPE_DATABASE_DB2
Deprecated.Connection to an IBM DB2 database- See Also:
- Constant Field Values
-
TYPE_DATABASE_POSTGRES
@Deprecated public static final int TYPE_DATABASE_POSTGRES
Deprecated.Connection to a PostgreSQL database- See Also:
- Constant Field Values
-
TYPE_DATABASE_CACHE
@Deprecated public static final int TYPE_DATABASE_CACHE
Deprecated.Connection to an Intersystems Cache database- See Also:
- Constant Field Values
-
TYPE_DATABASE_INFORMIX
@Deprecated public static final int TYPE_DATABASE_INFORMIX
Deprecated.Connection to an IBM Informix database- See Also:
- Constant Field Values
-
TYPE_DATABASE_SYBASE
@Deprecated public static final int TYPE_DATABASE_SYBASE
Deprecated.Connection to a Sybase ASE database- See Also:
- Constant Field Values
-
TYPE_DATABASE_GUPTA
@Deprecated public static final int TYPE_DATABASE_GUPTA
Deprecated.Connection to a Gupta SQLBase database- See Also:
- Constant Field Values
-
TYPE_DATABASE_DBASE
@Deprecated public static final int TYPE_DATABASE_DBASE
Deprecated.Connection to a DBase III/IV/V database through JDBC- See Also:
- Constant Field Values
-
TYPE_DATABASE_FIREBIRD
@Deprecated public static final int TYPE_DATABASE_FIREBIRD
Deprecated.Connection to a FireBird database- See Also:
- Constant Field Values
-
TYPE_DATABASE_SAPDB
@Deprecated public static final int TYPE_DATABASE_SAPDB
Deprecated.Connection to a SAP DB database- See Also:
- Constant Field Values
-
TYPE_DATABASE_HYPERSONIC
@Deprecated public static final int TYPE_DATABASE_HYPERSONIC
Deprecated.Connection to a Hypersonic java database- See Also:
- Constant Field Values
-
TYPE_DATABASE_GENERIC
@Deprecated public static final int TYPE_DATABASE_GENERIC
Deprecated.Connection to a generic database- See Also:
- Constant Field Values
-
TYPE_DATABASE_SAPR3
@Deprecated public static final int TYPE_DATABASE_SAPR3
Deprecated.Connection to an SAP R/3 system- See Also:
- Constant Field Values
-
TYPE_DATABASE_INGRES
@Deprecated public static final int TYPE_DATABASE_INGRES
Deprecated.Connection to an Ingress database- See Also:
- Constant Field Values
-
TYPE_DATABASE_INTERBASE
@Deprecated public static final int TYPE_DATABASE_INTERBASE
Deprecated.Connection to a Borland Interbase database- See Also:
- Constant Field Values
-
TYPE_DATABASE_EXTENDB
@Deprecated public static final int TYPE_DATABASE_EXTENDB
Deprecated.Connection to an ExtenDB database- See Also:
- Constant Field Values
-
TYPE_DATABASE_TERADATA
@Deprecated public static final int TYPE_DATABASE_TERADATA
Deprecated.Connection to a Teradata database- See Also:
- Constant Field Values
-
TYPE_DATABASE_ORACLE_RDB
@Deprecated public static final int TYPE_DATABASE_ORACLE_RDB
Deprecated.Connection to an Oracle RDB database- See Also:
- Constant Field Values
-
TYPE_DATABASE_H2
@Deprecated public static final int TYPE_DATABASE_H2
Deprecated.Connection to an H2 database- See Also:
- Constant Field Values
-
TYPE_DATABASE_NETEZZA
@Deprecated public static final int TYPE_DATABASE_NETEZZA
Deprecated.Connection to a Netezza database- See Also:
- Constant Field Values
-
TYPE_DATABASE_UNIVERSE
@Deprecated public static final int TYPE_DATABASE_UNIVERSE
Deprecated.Connection to an IBM UniVerse database- See Also:
- Constant Field Values
-
TYPE_DATABASE_SQLITE
@Deprecated public static final int TYPE_DATABASE_SQLITE
Deprecated.Connection to a SQLite database- See Also:
- Constant Field Values
-
TYPE_DATABASE_DERBY
@Deprecated public static final int TYPE_DATABASE_DERBY
Deprecated.Connection to an Apache Derby database- See Also:
- Constant Field Values
-
TYPE_DATABASE_REMEDY_AR_SYSTEM
@Deprecated public static final int TYPE_DATABASE_REMEDY_AR_SYSTEM
Deprecated.Connection to a BMC Remedy Action Request System- See Also:
- Constant Field Values
-
TYPE_DATABASE_PALO
@Deprecated public static final int TYPE_DATABASE_PALO
Deprecated.Connection to a Palo MOLAP Server- See Also:
- Constant Field Values
-
TYPE_DATABASE_SYBASEIQ
@Deprecated public static final int TYPE_DATABASE_SYBASEIQ
Deprecated.Connection to a SybaseIQ ASE database- See Also:
- Constant Field Values
-
TYPE_DATABASE_GREENPLUM
@Deprecated public static final int TYPE_DATABASE_GREENPLUM
Deprecated.Connection to a Greenplum database- See Also:
- Constant Field Values
-
TYPE_DATABASE_MONETDB
@Deprecated public static final int TYPE_DATABASE_MONETDB
Deprecated.Connection to a MonetDB database- See Also:
- Constant Field Values
-
TYPE_DATABASE_KINGBASEES
@Deprecated public static final int TYPE_DATABASE_KINGBASEES
Deprecated.Connection to a KingbaseES database- See Also:
- Constant Field Values
-
TYPE_DATABASE_VERTICA
@Deprecated public static final int TYPE_DATABASE_VERTICA
Deprecated.Connection to a Vertica database- See Also:
- Constant Field Values
-
TYPE_DATABASE_NEOVIEW
@Deprecated public static final int TYPE_DATABASE_NEOVIEW
Deprecated.Connection to a Neoview database- See Also:
- Constant Field Values
-
TYPE_DATABASE_LUCIDDB
@Deprecated public static final int TYPE_DATABASE_LUCIDDB
Deprecated.Connection to a LucidDB database- See Also:
- Constant Field Values
-
TYPE_DATABASE_INFOBRIGHT
@Deprecated public static final int TYPE_DATABASE_INFOBRIGHT
Deprecated.Connection to an Infobright database- See Also:
- Constant Field Values
-
TYPE_ACCESS_NATIVE
public static final int TYPE_ACCESS_NATIVE
Connect natively through JDBC thin driver to the database.- See Also:
- Constant Field Values
-
TYPE_ACCESS_ODBC
public static final int TYPE_ACCESS_ODBC
Connect to the database using ODBC.- See Also:
- Constant Field Values
-
TYPE_ACCESS_OCI
public static final int TYPE_ACCESS_OCI
Connect to the database using OCI. (Oracle only)- See Also:
- Constant Field Values
-
TYPE_ACCESS_PLUGIN
public static final int TYPE_ACCESS_PLUGIN
Connect to the database using plugin specific method. (SAP ERP)- See Also:
- Constant Field Values
-
TYPE_ACCESS_JNDI
public static final int TYPE_ACCESS_JNDI
Connect to the database using JNDI.- See Also:
- Constant Field Values
-
dbAccessTypeCode
public static final String[] dbAccessTypeCode
Short description of the access type, used in XML and the repository.
-
dbAccessTypeDesc
public static final String[] dbAccessTypeDesc
Longer description for user interactions.
-
CLOB_LENGTH
public static final int CLOB_LENGTH
Use this length in a String value to indicate that you want to use a CLOB in stead of a normal text field.- See Also:
- Constant Field Values
-
EMPTY_OPTIONS_STRING
public static final String EMPTY_OPTIONS_STRING
The value to store in the attributes so that an empty value doesn't get lost...- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DatabaseMeta
public DatabaseMeta(String name, String type, String access, String host, String db, String port, String user, String pass)
Construct a new database connections. Note that not all these parameters are not always mandatory.- Parameters:
name- The database nametype- The type of databaseaccess- The type of database accesshost- The hostname or IP addressdb- The database nameport- The port on which the database listens.user- The usernamepass- The password
-
DatabaseMeta
public DatabaseMeta()
Create an empty database connection
-
DatabaseMeta
public DatabaseMeta(String xml) throws KettleXMLException
Constructs a new database using an XML string snippet. It expects the snippet to be enclosed inconnectiontags.- Parameters:
xml- The XML string to parse- Throws:
KettleXMLException- in case there is an XML parsing error
-
DatabaseMeta
public DatabaseMeta(Node con) throws KettleXMLException
Reads the information from an XML Node into this new database connection.- Parameters:
con- The Node to read the data from- Throws:
KettleXMLException
-
-
Method Detail
-
init
public static void init()
-
setDefault
public void setDefault()
Set default values for an Oracle database.
-
addOptions
public void addOptions()
Add a list of common options for some databases.
-
getDatabaseInterface
public DatabaseInterface getDatabaseInterface()
- Returns:
- the system dependend database interface for this database metadata definition
-
setDatabaseInterface
public void setDatabaseInterface(DatabaseInterface databaseInterface)
Set the system dependend database interface for this database metadata definition- Parameters:
databaseInterface- the system dependend database interface
-
getDatabaseInterface
public static final DatabaseInterface getDatabaseInterface(String databaseType) throws KettleDatabaseException
Search for the right type of DatabaseInterface object and clone it.- Parameters:
databaseType- the type of DatabaseInterface to look for (description)- Returns:
- The requested DatabaseInterface
- Throws:
KettleDatabaseException- when the type could not be found or referenced.
-
getObjectId
public ObjectId getObjectId()
Returns the database ID of this database connection if a repository was used before.- Specified by:
getObjectIdin interfaceRepositoryElementInterface- Specified by:
getObjectIdin interfaceRepositoryObjectInterface- Returns:
- the ID of the db connection.
-
setObjectId
public void setObjectId(ObjectId id)
Description copied from interface:RepositoryElementInterfaceSets the database ID in the repository for this object.- Specified by:
setObjectIdin interfaceRepositoryElementInterface
-
deepClone
public Object deepClone(boolean cloneUpdateFlag)
-
replaceMeta
public void replaceMeta(DatabaseMeta databaseMeta, boolean cloneUpdateFlag)
-
replaceMeta
public void replaceMeta(DatabaseMeta databaseMeta)
-
setValues
public void setValues(String name, String type, String access, String host, String db, String port, String user, String pass)
-
setDatabaseType
public void setDatabaseType(String type)
-
setValues
public void setValues(DatabaseMeta info)
-
setName
public void setName(String name)
Sets the name of the database connection. This name should be unique in a transformation and in general in a single repository.- Specified by:
setNamein interfaceRepositoryElementInterface- Parameters:
name- The name of the database connection
-
getName
public String getName()
Returns the name of the database connection- Specified by:
getNamein interfaceRepositoryElementInterface- Specified by:
getNamein interfaceRepositoryObjectInterface- Specified by:
getNamein interfaceSharedObjectInterface- Returns:
- The name of the database connection
-
setDisplayName
public void setDisplayName(String displayName)
-
getDisplayName
public String getDisplayName()
Returns the name of the database connection- Returns:
- The name of the database connection
-
getPluginId
public String getPluginId()
The plugin ID of the database interface
-
getAccessType
public int getAccessType()
Return the type of database access. One ofTYPE_ACCESS_NATIVE
TYPE_ACCESS_ODBC
TYPE_ACCESS_OCI
- Returns:
- The type of database access.
-
setAccessType
public void setAccessType(int access_type)
Set the type of database access.- Parameters:
access_type- The access type.
-
getDatabaseTypeDesc
@Deprecated public String getDatabaseTypeDesc()
Deprecated.This is actually the plugin IDReturns a short description of the type of database.- Returns:
- A short description of the type of database.
-
getAccessTypeDesc
public String getAccessTypeDesc()
Gets you a short description of the type of database access.- Returns:
- A short description of the type of database access.
-
getHostname
public String getHostname()
Return the hostname of the machine on which the database runs.- Returns:
- The hostname of the database.
-
setHostname
public void setHostname(String hostname)
Sets the hostname of the machine on which the database runs.- Parameters:
hostname- The hostname of the machine on which the database runs.
-
getDatabasePortNumberString
public String getDatabasePortNumberString()
Return the port on which the database listens as a String. Allows for parameterisation.- Returns:
- The database port.
-
setDBPort
public void setDBPort(String db_port)
Sets the port on which the database listens.- Parameters:
db_port- The port number on which the database listens
-
getDatabaseName
public String getDatabaseName()
Return the name of the database.- Returns:
- The database name.
-
setDBName
public void setDBName(String databaseName)
Set the name of the database.- Parameters:
databaseName- The new name of the database
-
getUsername
public String getUsername()
Get the username to log into the database on this connection.- Returns:
- The username to log into the database on this connection.
-
setUsername
public void setUsername(String username)
Sets the username to log into the database on this connection.- Parameters:
username- The username
-
getPassword
public String getPassword()
Get the password to log into the database on this connection.- Returns:
- the password to log into the database on this connection.
-
setPassword
public void setPassword(String password)
Sets the password to log into the database on this connection.- Parameters:
password- the password to log into the database on this connection.
-
setServername
public void setServername(String servername)
- Parameters:
servername- the Informix servername
-
getServername
public String getServername()
- Returns:
- the Informix servername
-
getDataTablespace
public String getDataTablespace()
-
setDataTablespace
public void setDataTablespace(String data_tablespace)
-
getIndexTablespace
public String getIndexTablespace()
-
setIndexTablespace
public void setIndexTablespace(String index_tablespace)
-
isNeedUpdate
public boolean isNeedUpdate()
-
setNeedUpdate
public void setNeedUpdate(boolean needUpdate)
-
setChanged
public void setChanged()
-
setChanged
public void setChanged(boolean ch)
-
hasChanged
public boolean hasChanged()
-
clearChanged
public void clearChanged()
-
getAttributes
public Properties getAttributes()
- Returns:
- The extra attributes for this database connection
-
setAttributes
public void setAttributes(Properties attributes)
Set extra attributes on this database connection- Parameters:
attributes- The extra attributes to set on this database connection.
-
getXML
public String getXML()
Description copied from interface:XMLInterfaceDescribes the Object implementing this interface as XML- Specified by:
getXMLin interfaceSharedObjectInterface- Specified by:
getXMLin interfaceXMLInterface- Returns:
- the XML string for this object
-
getURL
public String getURL() throws KettleDatabaseException
- Throws:
KettleDatabaseException
-
getURL
public String getURL(String partitionId) throws KettleDatabaseException
- Throws:
KettleDatabaseException
-
appendExtraOptions
protected String appendExtraOptions(String url, Map<String,String> extraOptions)
-
databaseForBothDbInterfacesIsTheSame
protected boolean databaseForBothDbInterfacesIsTheSame(DatabaseInterface primary, DatabaseInterface secondary)
This method is designed to identify whether the actual database for two database connection types is the same. This situation can occur in two cases: 1. plugin id ofprimaryis the same as plugin id ofsecondary2.secondaryis a descendantprimary(with any deepness).
-
getConnectionProperties
public Properties getConnectionProperties()
-
getExtraOptionIndicator
public String getExtraOptionIndicator()
-
getExtraOptionSeparator
public String getExtraOptionSeparator()
- Returns:
- The extra option separator in database URL for this platform (usually this is semicolon ; )
-
getExtraOptionValueSeparator
public String getExtraOptionValueSeparator()
- Returns:
- The extra option value separator in database URL for this platform (usually this is the equal sign = )
-
addExtraOption
public 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 appliesoption- The option to setvalue- The value of the option
-
applyDefaultOptions
public void applyDefaultOptions(DatabaseInterface databaseInterface)
-
supportsTransactions
@Deprecated public boolean supportsTransactions()
Deprecated.because the same database can support transactions or not. It all depends on the database setup. Therefor, we look at the database metadata DatabaseMetaData.supportsTransactions() in stead of this.- Returns:
- true if the database supports transactions
-
supportsAutoinc
public boolean supportsAutoinc()
-
supportsSequences
public boolean supportsSequences()
-
supportsBitmapIndex
public boolean supportsBitmapIndex()
-
supportsSetLong
public boolean supportsSetLong()
-
supportsSchemas
public boolean supportsSchemas()
- Returns:
- true if the database supports schemas
-
supportsCatalogs
public boolean supportsCatalogs()
- Returns:
- true if the database supports catalogs
-
supportsEmptyTransactions
public boolean supportsEmptyTransactions()
- Returns:
- true when the database engine supports empty transaction. (for example Informix does not on a non-ANSI database type!)
-
supportsSetCharacterStream
public 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.
-
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!)- Returns:
- The maximum text field length for this database type. (mostly CLOB_LENGTH)
-
getAccessType
public static final int getAccessType(String dbaccess)
-
getAccessTypeDesc
public static final String getAccessTypeDesc(int dbaccess)
-
getAccessTypeDescLong
public static final String getAccessTypeDescLong(int dbaccess)
-
getDatabaseInterfaces
public static final DatabaseInterface[] getDatabaseInterfaces()
-
clearDatabaseInterfacesMap
public static final void clearDatabaseInterfacesMap()
Clear the database interfaces map. The map is cached by getDatabaseInterfacesMap(), but in some instances it may need to be reloaded (such as adding/updating Database plugins). After calling clearDatabaseInterfacesMap(), the next call to getDatabaseInterfacesMap() will reload the map.
-
getDatabaseInterfacesMap
public static final Map<String,DatabaseInterface> getDatabaseInterfacesMap()
-
getAccessTypeList
public static final int[] getAccessTypeList(String dbTypeDesc)
-
getDefaultDatabasePort
public int getDefaultDatabasePort()
-
getNotFoundTK
public int getNotFoundTK(boolean use_autoinc)
-
getDriverClass
public String getDriverClass()
-
stripCR
public String stripCR(StringBuffer sbsql)
-
stripCR
public String stripCR(StringBuilder sbsql)
-
isFetchSizeSupported
public boolean isFetchSizeSupported()
-
needsPlaceHolder
public 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
public String getFunctionSum()
-
getFunctionAverage
public String getFunctionAverage()
-
getFunctionMaximum
public String getFunctionMaximum()
-
getFunctionMinimum
public String getFunctionMinimum()
-
getFunctionCount
public String getFunctionCount()
-
checkParameters
public String[] checkParameters()
Check the database connection parameters and give back an array of remarks- Returns:
- an array of remarks Strings
-
getSchemaTableCombination
@Deprecated public String getSchemaTableCombination(String schemaName, String tableName)
Deprecated.please use getQuotedSchemaTableCombination()This is now replaced with getQuotedSchemaTableCombination(), enforcing the use of the quoteFields call- Parameters:
schemaName-tableName-- Returns:
-
getQuotedSchemaTableCombination
public String getQuotedSchemaTableCombination(String schemaName, String tableName)
Calculate the schema-table combination, usually this is the schema and table separated with a dot. (schema.table)- Parameters:
schemaName- the schema-name or null if no schema is used.tableName- the table name- Returns:
- the schemaname-tablename combination
-
isClob
public boolean isClob(ValueMetaInterface v)
-
getFieldDefinition
public String getFieldDefinition(ValueMetaInterface v, String tk, String pk, boolean use_autoinc)
-
getFieldDefinition
public String getFieldDefinition(ValueMetaInterface v, String tk, String pk, boolean use_autoinc, boolean add_fieldname, boolean add_cr)
-
getLimitClause
public String getLimitClause(int nrRows)
-
getSQLQueryFields
public String getSQLQueryFields(String tableName)
- Parameters:
tableName- The table or schema-table combination. We expect this to be quoted properly already!- Returns:
- the SQL for to get the fields of this table.
-
getAddColumnStatement
public String getAddColumnStatement(String tablename, ValueMetaInterface v, String tk, boolean use_autoinc, String pk, boolean semicolon)
-
getDropColumnStatement
public String getDropColumnStatement(String tablename, ValueMetaInterface v, String tk, boolean use_autoinc, String pk, boolean semicolon)
-
getModifyColumnStatement
public String getModifyColumnStatement(String tablename, ValueMetaInterface v, String tk, boolean use_autoinc, String pk, boolean semicolon)
-
getReservedWords
public String[] getReservedWords()
- Returns:
- an array of reserved words for the database type...
-
quoteReservedWords
public boolean quoteReservedWords()
- Returns:
- true if reserved words need to be double quoted ("password", "select", ...)
-
getStartQuote
public String getStartQuote()
- Returns:
- The start quote sequence, mostly just double quote, but sometimes [, ...
-
getEndQuote
public String getEndQuote()
- Returns:
- The end quote sequence, mostly just double quote, but sometimes ], ...
-
quoteField
public String quoteField(String field)
Returns a quoted field if this is needed: contains spaces, is a reserved word, ...- Parameters:
field- The fieldname to check for quoting- Returns:
- The quoted field (if this is needed.
-
isInNeedOfQuoting
public boolean isInNeedOfQuoting(String fieldname)
Determines whether or not this field is in need of quoting:
- When the fieldname contains spaces
- When the fieldname is a reserved word- Parameters:
fieldname- the fieldname to check if there is a need for quoting- Returns:
- true if the fieldname needs to be quoted.
-
isReservedWord
public boolean isReservedWord(String word)
Returns true if the string specified is a reserved word on this database type.- Parameters:
word- The word to check- Returns:
- true if word is a reserved word on this database.
-
hasSpacesInField
public boolean hasSpacesInField(String fieldname)
Detects if a field has spaces in the name. We need to quote the field in that case.- Parameters:
fieldname- The fieldname to check for spaces- Returns:
- true if the fieldname contains spaces
-
hasSpecialCharInField
public boolean hasSpecialCharInField(String fieldname)
Detects if a field has spaces in the name. We need to quote the field in that case.- Parameters:
fieldname- The fieldname to check for spaces- Returns:
- true if the fieldname contains spaces
-
hasDotInField
public boolean hasDotInField(String fieldname)
-
replaceReservedWords
public boolean replaceReservedWords(RowMetaInterface fields)
Checks the fields specified for reserved words and quotes them.- Parameters:
fields- the list of fields to check- Returns:
- true if one or more values have a name that is a reserved word on this database type.
-
getNrReservedWords
public int getNrReservedWords(RowMetaInterface fields)
Checks the fields specified for reserved words- Parameters:
fields- the list of fields to check- Returns:
- The nr of reserved words for this database.
-
getTableTypes
public String[] getTableTypes()
- Returns:
- a list of types to get the available tables
-
getViewTypes
public String[] getViewTypes()
- Returns:
- a list of types to get the available views
-
getSynonymTypes
public String[] getSynonymTypes()
- Returns:
- a list of types to get the available synonyms
-
useSchemaNameForTableList
public boolean useSchemaNameForTableList()
- 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()
- Returns:
- true if the database supports views
-
supportsSynonyms
public boolean supportsSynonyms()
- Returns:
- true if the database supports synonyms
-
getSQLListOfProcedures
public String getSQLListOfProcedures()
- Returns:
- The SQL on this database to get a list of stored procedures.
-
getTruncateTableStatement
public String getTruncateTableStatement(String schema, String tableName)
- Parameters:
tableName- The tablename to be truncated- Returns:
- The SQL statement to remove all rows from the specified statement, if possible without using transactions
-
supportsFloatRoundingOnUpdate
public 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
public String getSQLLockTables(String[] tableNames)
- Parameters:
tableNames- The names of the tables to lock- Returns:
- The SQL commands to lock database tables for write purposes. null is returned in case locking is not supported on the target database.
-
getSQLUnlockTables
public String getSQLUnlockTables(String[] tableNames)
- Parameters:
tableNames- The names of the tables to unlock- Returns:
- The SQL commands to unlock databases tables. null is returned in case locking is not supported on the target database.
-
getFeatureSummary
public List<RowMetaAndData> getFeatureSummary()
- Returns:
- a feature list for the chosen database type.
-
supportsTimeStampToDateConversion
public boolean supportsTimeStampToDateConversion()
- Returns:
- true if the database result sets support getTimeStamp() to retrieve date-time. (Date)
-
supportsBatchUpdates
public boolean supportsBatchUpdates()
- Returns:
- true if the database JDBC driver supports batch updates For example Interbase doesn't support this!
-
supportsBooleanDataType
public boolean supportsBooleanDataType()
- Returns:
- true if the database supports a boolean, bit, logical, ... datatype
-
setSupportsBooleanDataType
public void setSupportsBooleanDataType(boolean b)
- Parameters:
b- Set to true if the database supports a boolean, bit, logical, ... datatype
-
supportsTimestampDataType
public boolean supportsTimestampDataType()
- Returns:
- true if the database supports the Timestamp data type (nanosecond precision and all)
-
setSupportsTimestampDataType
public void setSupportsTimestampDataType(boolean b)
- Parameters:
b- Set to true if the database supports the Timestamp data type (nanosecond precision and all)
-
preserveReservedCase
public boolean preserveReservedCase()
- Returns:
- true if reserved words' case should be preserved
-
setPreserveReservedCase
public void setPreserveReservedCase(boolean b)
-
quoteReservedWords
public void quoteReservedWords(RowMetaInterface fields)
Changes the names of the fields to their quoted equivalent if this is needed- Parameters:
fields- The row of fields to change
-
getExtraOptions
public Map<String,String> getExtraOptions()
- Returns:
- a map of all the extra URL options you want to set.
-
supportsOptionsInURL
public boolean supportsOptionsInURL()
- Returns:
- true if the database supports connection options in the URL, false if they are put in a Properties object.
-
getExtraOptionsHelpText
public String getExtraOptionsHelpText()
- Returns:
- extra help text on the supported options on the selected database platform.
-
supportsGetBlob
public 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
public String getConnectSQL()
- Returns:
- The SQL to execute right after connecting
-
setConnectSQL
public void setConnectSQL(String sql)
- Parameters:
sql- The SQL to execute right after connecting
-
supportsSetMaxRows
public boolean supportsSetMaxRows()
- Returns:
- true if the database supports setting the maximum number of return rows in a resultset.
-
verifyAndModifyDatabaseName
public String verifyAndModifyDatabaseName(List<DatabaseMeta> databases, String oldname)
Verify the name of the database and if required, change it if it already exists in the list of databases.- Parameters:
databases- the databases to check against.oldname- the old name of the database- Returns:
- the new name of the database connection
-
isUsingConnectionPool
public boolean isUsingConnectionPool()
- Returns:
- true if we want to use a database connection pool
-
setUsingConnectionPool
public void setUsingConnectionPool(boolean usePool)
- Parameters:
usePool- true if we want to use a database connection pool
-
getMaximumPoolSize
public int getMaximumPoolSize()
- Returns:
- the maximum pool size
-
getMaximumPoolSizeString
public String getMaximumPoolSizeString()
- Returns:
- the maximum pool size variable name
-
setMaximumPoolSize
public void setMaximumPoolSize(int maximumPoolSize)
- Parameters:
maximumPoolSize- the maximum pool size
-
setMaximumPoolSizeString
public void setMaximumPoolSizeString(String maximumPoolSize)
- Parameters:
maximumPoolSize- the maximum pool size variable name
-
getInitialPoolSize
public int getInitialPoolSize()
- Returns:
- the initial pool size
-
getInitialPoolSizeString
public String getInitialPoolSizeString()
- Returns:
- the initial pool size variable name
-
setInitialPoolSize
public void setInitialPoolSize(int initalPoolSize)
- Parameters:
initalPoolSize- the initial pool size
-
setInitialPoolSizeString
public void setInitialPoolSizeString(String initalPoolSize)
- Parameters:
initalPoolSize- the initial pool size variable name
-
isPartitioned
public boolean isPartitioned()
- Returns:
- true if the connection contains partitioning information
-
setPartitioned
public void setPartitioned(boolean partitioned)
- Parameters:
partitioned- true if the connection is set to contain partitioning information
-
getPartitioningInformation
public PartitionDatabaseMeta[] getPartitioningInformation()
- Returns:
- the available partition/host/databases/port combinations in the cluster
-
setPartitioningInformation
public void setPartitioningInformation(PartitionDatabaseMeta[] partitionInfo)
- Parameters:
partitionInfo- the available partition/host/databases/port combinations in the cluster
-
getPartitionMeta
public PartitionDatabaseMeta getPartitionMeta(String partitionId)
Finds the partition metadata for the given partition iD- Parameters:
partitionId- The partition ID to look for- Returns:
- the partition database metadata or null if nothing was found.
-
getConnectionPoolingProperties
public Properties getConnectionPoolingProperties()
-
setConnectionPoolingProperties
public void setConnectionPoolingProperties(Properties properties)
-
needsToLockAllTables
public boolean needsToLockAllTables()
-
isStreamingResults
public boolean isStreamingResults()
- Returns:
- true if the database is streaming results (normally this is an option just for MySQL).
-
setStreamingResults
public void setStreamingResults(boolean useStreaming)
- Parameters:
useStreaming- true if we want the database to stream results (normally this is an option just for MySQL).
-
isQuoteAllFields
public boolean isQuoteAllFields()
- Returns:
- true if all fields should always be quoted in db
-
setQuoteAllFields
public void setQuoteAllFields(boolean quoteAllFields)
- Parameters:
quoteAllFields- true if all fields in DB should be quoted.
-
isForcingIdentifiersToLowerCase
public boolean isForcingIdentifiersToLowerCase()
- Returns:
- true if all identifiers should be forced to lower case
-
setForcingIdentifiersToLowerCase
public void setForcingIdentifiersToLowerCase(boolean forceLowerCase)
- Parameters:
forceLowerCase- true if all identifiers should be forced to lower case
-
isForcingIdentifiersToUpperCase
public boolean isForcingIdentifiersToUpperCase()
- Returns:
- true if all identifiers should be forced to upper case
-
setForcingIdentifiersToUpperCase
public void setForcingIdentifiersToUpperCase(boolean forceUpperCase)
- Parameters:
forceUpperCase- true if all identifiers should be forced to upper case
-
findDatabase
public static final DatabaseMeta findDatabase(List<? extends SharedObjectInterface> databases, String dbname)
Find a database with a certain name in an arraylist of databases.- Parameters:
databases- The ArrayList of databasesdbname- The name of the database connection- Returns:
- The database object if one was found, null otherwise.
-
findDatabase
public static final DatabaseMeta findDatabase(List<DatabaseMeta> databases, ObjectId id)
Find a database with a certain ID in an arraylist of databases.- Parameters:
databases- The ArrayList of databasesid- The id of the database connection- Returns:
- The database object if one was found, null otherwise.
-
copyVariablesFrom
public void copyVariablesFrom(VariableSpace space)
Description copied from interface:VariableSpaceCopy the variables from another space, without initializing with the defaults. This does not affect any parent relationship.- Specified by:
copyVariablesFromin interfaceVariableSpace- Parameters:
space- the space to copy the variables from.
-
environmentSubstitute
public String environmentSubstitute(String aString)
Description copied from interface:VariableSpaceSubstitute the string using the current variable space.- Specified by:
environmentSubstitutein interfaceVariableSpace- Parameters:
aString- The string to substitute.- Returns:
- The substituted string.
-
environmentSubstitute
public String[] environmentSubstitute(String[] aString)
Description copied from interface:VariableSpaceReplaces environment variables in an array of strings. See also: environmentSubstitute(String string)- Specified by:
environmentSubstitutein interfaceVariableSpace- Parameters:
aString- The array of strings that wants its variables to be replaced.- Returns:
- the array with the environment variables replaced.
-
fieldSubstitute
public String fieldSubstitute(String aString, RowMetaInterface rowMeta, Object[] rowData) throws KettleValueException
Description copied from interface:VariableSpaceSubstitutes field values inaString. Field values are of the form "?{}". The values are retrieved from the specified row. Please note that the getString() method is used to convert to a String, for all values in the row. - Specified by:
fieldSubstitutein interfaceVariableSpace- Parameters:
aString- the string on which to apply the substitution.rowMeta- The row metadata to use.rowData- The row data to use- Returns:
- the string with the substitution applied.
- Throws:
KettleValueException- In case there is a String conversion error
-
getParentVariableSpace
public VariableSpace getParentVariableSpace()
Description copied from interface:VariableSpaceGet the parent of the variable space.- Specified by:
getParentVariableSpacein interfaceVariableSpace- Returns:
- the parent.
-
setParentVariableSpace
public void setParentVariableSpace(VariableSpace parent)
Description copied from interface:VariableSpaceSet the parent variable space- Specified by:
setParentVariableSpacein interfaceVariableSpace- Parameters:
parent- The parent variable space to set
-
getVariable
public String getVariable(String variableName, String defaultValue)
Description copied from interface:VariableSpaceGet the value of a variable with a default in case the variable is not found.- Specified by:
getVariablein interfaceVariableSpace- Parameters:
variableName- The name of the variabledefaultValue- The default value in case the variable could not be found- Returns:
- the String value of a variable
-
getVariable
public String getVariable(String variableName)
Description copied from interface:VariableSpaceGet the value of a variable.- Specified by:
getVariablein interfaceVariableSpace- Parameters:
variableName- The name of the variable- Returns:
- the String value of a variable or null in case the variable could not be found.
-
getBooleanValueOfVariable
public boolean getBooleanValueOfVariable(String variableName, boolean defaultValue)
Description copied from interface:VariableSpaceThis method returns a boolean for the new variable check boxes. If the variable name is not set or the variable name is not specified, this method simply returns the default value. If not, it convert the variable value to a boolean. "Y", "YES" and "TRUE" all convert to true. (case insensitive)- Specified by:
getBooleanValueOfVariablein interfaceVariableSpace- Parameters:
variableName- The variable to look up.defaultValue- The default value to return.- Returns:
- See Also:
static method ValueMeta.convertStringToBoolean()
-
initializeVariablesFrom
public void initializeVariablesFrom(VariableSpace parent)
Description copied from interface:VariableSpaceInitialize variable space using the defaults, copy over the variables from the parent (using copyVariablesFrom()), after this the "injected" variables should be inserted (injectVariables()). The parent is set as parent variable space.- Specified by:
initializeVariablesFromin interfaceVariableSpace- Parameters:
parent- the parent to start from, or null if root.
-
listVariables
public String[] listVariables()
Description copied from interface:VariableSpaceList the variables (not the values) that are currently in the variable space.- Specified by:
listVariablesin interfaceVariableSpace- Returns:
- Array of String variable names.
-
setVariable
public void setVariable(String variableName, String variableValue)
Description copied from interface:VariableSpaceSets a variable in the Kettle Variables list.- Specified by:
setVariablein interfaceVariableSpace- Parameters:
variableName- The name of the variable to setvariableValue- The value of the variable to set. If the variableValue is null, the variable is cleared from the list.
-
shareVariablesWith
public void shareVariablesWith(VariableSpace space)
Description copied from interface:VariableSpaceShare a variable space from another variable space. This means that the object should take over the space used as argument.- Specified by:
shareVariablesWithin interfaceVariableSpace- Parameters:
space- Variable space to be shared.
-
injectVariables
public void injectVariables(Map<String,String> prop)
Description copied from interface:VariableSpaceInject variables. The behaviour should be that the properties object will be stored and at the time the VariableSpace is initialized (or upon calling this method if the space is already initialized). After injecting the link of the properties object should be removed.- Specified by:
injectVariablesin interfaceVariableSpace- Parameters:
prop- Properties object containing key-value pairs.
-
getSQLServerInstance
public String getSQLServerInstance()
- Returns:
- the SQL Server instance
-
setSQLServerInstance
public void setSQLServerInstance(String instanceName)
- Parameters:
instanceName- the SQL Server instance
-
isUsingDoubleDecimalAsSchemaTableSeparator
public boolean isUsingDoubleDecimalAsSchemaTableSeparator()
- Returns:
- true if the Microsoft SQL server uses two decimals (..) to separate schema and table (default==false).
-
setUsingDoubleDecimalAsSchemaTableSeparator
public void setUsingDoubleDecimalAsSchemaTableSeparator(boolean useDoubleDecimalSeparator)
- Parameters:
useDoubleDecimalSeparator- true if we want the database to stream results (normally this is an option just for MySQL).
-
isRequiringTransactionsOnQueries
public boolean isRequiringTransactionsOnQueries()
- Returns:
- true if this database needs a transaction to perform a query (auto-commit turned off).
-
testConnection
public String testConnection()
-
testConnectionSuccess
public DatabaseTestResults testConnectionSuccess()
-
getDatabaseFactory
public DatabaseFactoryInterface getDatabaseFactory() throws Exception
- Throws:
Exception
-
getPreferredSchemaName
public String getPreferredSchemaName()
-
setPreferredSchemaName
public void setPreferredSchemaName(String preferredSchemaName)
-
getRepositoryDirectory
public RepositoryDirectoryInterface getRepositoryDirectory()
Not used in this case, simply return root /- Specified by:
getRepositoryDirectoryin interfaceRepositoryElementInterface
-
setRepositoryDirectory
public void setRepositoryDirectory(RepositoryDirectoryInterface repositoryDirectory)
- Specified by:
setRepositoryDirectoryin interfaceRepositoryElementInterface
-
getRepositoryElementType
public RepositoryObjectType getRepositoryElementType()
Description copied from interface:RepositoryElementInterfaceGets the repository element type for this object.- Specified by:
getRepositoryElementTypein interfaceRepositoryElementInterface- Returns:
- the repository element type for this object
-
getObjectRevision
public ObjectRevision getObjectRevision()
Description copied from interface:RepositoryElementInterfaceGets the object revision.- Specified by:
getObjectRevisionin interfaceRepositoryElementInterface- Returns:
- the object revision
-
setObjectRevision
public void setObjectRevision(ObjectRevision objectRevision)
Description copied from interface:RepositoryElementInterfaceSets the object revision.- Specified by:
setObjectRevisionin interfaceRepositoryElementInterface
-
getDescription
public String getDescription()
Description copied from interface:RepositoryElementInterfaceGets the description of the repository object.- Specified by:
getDescriptionin interfaceRepositoryElementInterface- Returns:
-
setDescription
public void setDescription(String description)
Description copied from interface:RepositoryElementInterfaceSets the description of the repository object.- Specified by:
setDescriptionin interfaceRepositoryElementInterface
-
supportsSequenceNoMaxValueOption
public boolean supportsSequenceNoMaxValueOption()
-
requiresCreateTablePrimaryKeyAppend
public boolean requiresCreateTablePrimaryKeyAppend()
-
requiresCastToVariousForIsNull
public boolean requiresCastToVariousForIsNull()
-
isDisplaySizeTwiceThePrecision
public boolean isDisplaySizeTwiceThePrecision()
-
supportsPreparedStatementMetadataRetrieval
public boolean supportsPreparedStatementMetadataRetrieval()
-
isSystemTable
public boolean isSystemTable(String tableName)
-
getSQLListOfSchemas
public String getSQLListOfSchemas()
-
getMaxColumnsInIndex
public int getMaxColumnsInIndex()
-
supportsErrorHandlingOnBatchUpdates
public boolean supportsErrorHandlingOnBatchUpdates()
-
getSQLInsertAutoIncUnknownDimensionRow
public 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 intokeyField- The key fieldversionField- the version field- Returns:
- the SQL to insert the unknown record into the SCD.
-
isExplorable
public boolean isExplorable()
- Returns:
- true if this is a relational database you can explore. Return false for SAP, PALO, etc.
-
getSQLListOfSequences
public String getSQLListOfSequences()
- Returns:
- The SQL on this database to get a list of sequences.
-
isMySQLVariant
public boolean isMySQLVariant()
-
getNextBatchId
public Long getNextBatchId(Database ldb, String schemaName, String tableName, String fieldName) throws KettleDatabaseException
- Throws:
KettleDatabaseException
-
getValueFromResultSet
public Object getValueFromResultSet(ResultSet rs, ValueMetaInterface val, int i) throws KettleDatabaseException
- Throws:
KettleDatabaseException
-
isReadOnly
public boolean isReadOnly()
Marker used to determine if the DatabaseMeta should be allowed to be modified/saved. It does NOT prevent object modification.- Returns:
-
setReadOnly
public void setReadOnly(boolean readOnly)
Sets the marker used to determine if the DatabaseMeta should be allowed to be modified/saved. Setting to true does NOT prevent object modification.
-
getSequenceNoMaxValueOption
public String getSequenceNoMaxValueOption()
-
supportsAutoGeneratedKeys
public boolean supportsAutoGeneratedKeys()
- Returns:
- true if the database supports autoGeneratedKeys
-
getCreateTableStatement
public String getCreateTableStatement()
Customizes the ValueMetaInterface defined in the base- Returns:
- String the create table statement
-
getDropTableIfExistsStatement
public String getDropTableIfExistsStatement(String tableName)
Forms the drop table statement specific for a certain RDBMS.- Parameters:
tableName- Name of the table to drop- Returns:
- Drop table statement specific for the current database
- See Also:
- BISERVER-13024
-
getGeneralLogger
protected LogChannelInterface getGeneralLogger()
For testing
-
getDbInterface
protected DatabaseInterface getDbInterface(String typeCode) throws KettleDatabaseException
For testing- Throws:
KettleDatabaseException
-
getTables
public ResultSet getTables(DatabaseMetaData databaseMetaData, String schema, String table, String[] tableTypesToGet) throws SQLException
- Throws:
SQLException
-
getSchemas
public ResultSet getSchemas(DatabaseMetaData databaseMetaData) throws SQLException
- Throws:
SQLException
-
getNamedCluster
public String getNamedCluster()
-
setNamedCluster
public void setNamedCluster(String namedCluster)
-
-