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 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.static Comparator<DatabaseMeta>
comparator
static String[]
dbAccessTypeCode
Short description of the access type, used in XML and the repository.static String[]
dbAccessTypeDesc
Longer description for user interactions.static String
EMPTY_OPTIONS_STRING
The value to store in the attributes so that an empty value doesn't get lost...static RepositoryObjectType
REPOSITORY_ELEMENT_TYPE
static int
TYPE_ACCESS_JNDI
Connect to the database using JNDI.static int
TYPE_ACCESS_NATIVE
Connect natively through JDBC thin driver to the database.static int
TYPE_ACCESS_OCI
Connect to the database using OCI.static int
TYPE_ACCESS_ODBC
Connect to the database using ODBC.static int
TYPE_ACCESS_PLUGIN
Connect to the database using plugin specific method.static int
TYPE_DATABASE_ACCESS
Deprecated.static int
TYPE_DATABASE_AS400
Deprecated.static int
TYPE_DATABASE_CACHE
Deprecated.static int
TYPE_DATABASE_DB2
Deprecated.static int
TYPE_DATABASE_DBASE
Deprecated.static int
TYPE_DATABASE_DERBY
Deprecated.static int
TYPE_DATABASE_EXTENDB
Deprecated.static int
TYPE_DATABASE_FIREBIRD
Deprecated.static int
TYPE_DATABASE_GENERIC
Deprecated.static int
TYPE_DATABASE_GREENPLUM
Deprecated.static int
TYPE_DATABASE_GUPTA
Deprecated.static int
TYPE_DATABASE_H2
Deprecated.static int
TYPE_DATABASE_HYPERSONIC
Deprecated.static int
TYPE_DATABASE_INFOBRIGHT
Deprecated.static int
TYPE_DATABASE_INFORMIX
Deprecated.static int
TYPE_DATABASE_INGRES
Deprecated.static int
TYPE_DATABASE_INTERBASE
Deprecated.static int
TYPE_DATABASE_KINGBASEES
Deprecated.static int
TYPE_DATABASE_LUCIDDB
Deprecated.static int
TYPE_DATABASE_MONETDB
Deprecated.static int
TYPE_DATABASE_MSSQL
Deprecated.static int
TYPE_DATABASE_MYSQL
Deprecated.static int
TYPE_DATABASE_NEOVIEW
Deprecated.static int
TYPE_DATABASE_NETEZZA
Deprecated.static int
TYPE_DATABASE_NONE
Deprecated.static int
TYPE_DATABASE_ORACLE
Deprecated.static int
TYPE_DATABASE_ORACLE_RDB
Deprecated.static int
TYPE_DATABASE_PALO
Deprecated.static int
TYPE_DATABASE_POSTGRES
Deprecated.static int
TYPE_DATABASE_REMEDY_AR_SYSTEM
Deprecated.static int
TYPE_DATABASE_SAPDB
Deprecated.static int
TYPE_DATABASE_SAPR3
Deprecated.static int
TYPE_DATABASE_SQLITE
Deprecated.static int
TYPE_DATABASE_SYBASE
Deprecated.static int
TYPE_DATABASE_SYBASEIQ
Deprecated.static int
TYPE_DATABASE_TERADATA
Deprecated.static int
TYPE_DATABASE_UNIVERSE
Deprecated.static int
TYPE_DATABASE_VERTICA
Deprecated.static String
XML_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 void
addExtraOption(String databaseTypeCode, String option, String value)
Add an extra option to the attributes listvoid
addOptions()
Add a list of common options for some databases.protected String
appendExtraOptions(String url, Map<String,String> extraOptions)
void
applyDefaultOptions(DatabaseInterface databaseInterface)
String[]
checkParameters()
Check the database connection parameters and give back an array of remarksvoid
clearChanged()
static void
clearDatabaseInterfacesMap()
Clear the database interfaces map.Object
clone()
void
copyVariablesFrom(VariableSpace space)
Copy the variables from another space, without initializing with the defaults.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.Object
deepClone(boolean cloneUpdateFlag)
String
environmentSubstitute(String aString)
Substitute the string using the current variable space.String[]
environmentSubstitute(String[] aString)
Replaces environment variables in an array of strings.boolean
equals(Object obj)
String
fieldSubstitute(String aString, RowMetaInterface rowMeta, Object[] rowData)
Substitutes field values inaString
.static DatabaseMeta
findDatabase(List<? extends SharedObjectInterface> databases, String dbname)
Find a database with a certain name in an arraylist of databases.static DatabaseMeta
findDatabase(List<DatabaseMeta> databases, ObjectId id)
Find a database with a certain ID in an arraylist of databases.String
generateColumnAlias(int columnIndex, String suggestedName)
int
getAccessType()
Return the type of database access.static int
getAccessType(String dbaccess)
String
getAccessTypeDesc()
Gets you a short description of the type of database access.static String
getAccessTypeDesc(int dbaccess)
static String
getAccessTypeDescLong(int dbaccess)
static int[]
getAccessTypeList(String dbTypeDesc)
String
getAddColumnStatement(String tablename, ValueMetaInterface v, String tk, boolean use_autoinc, String pk, boolean semicolon)
Properties
getAttributes()
boolean
getBooleanValueOfVariable(String variableName, boolean defaultValue)
This method returns a boolean for the new variable check boxes.Properties
getConnectionPoolingProperties()
Properties
getConnectionProperties()
String
getConnectSQL()
String
getCreateTableStatement()
Customizes the ValueMetaInterface defined in the baseDatabaseFactoryInterface
getDatabaseFactory()
DatabaseInterface
getDatabaseInterface()
static DatabaseInterface
getDatabaseInterface(String databaseType)
Search for the right type of DatabaseInterface object and clone it.static DatabaseInterface[]
getDatabaseInterfaces()
static Map<String,DatabaseInterface>
getDatabaseInterfacesMap()
String
getDatabaseName()
Return the name of the database.String
getDatabasePortNumberString()
Return the port on which the database listens as a String.String
getDatabaseTypeDesc()
Deprecated.This is actually the plugin IDString
getDataTablespace()
protected DatabaseInterface
getDbInterface(String typeCode)
For testingint
getDefaultDatabasePort()
String
getDescription()
Gets the description of the repository object.String
getDisplayName()
Returns the name of the database connectionString
getDriverClass()
String
getDropColumnStatement(String tablename, ValueMetaInterface v, String tk, boolean use_autoinc, String pk, boolean semicolon)
String
getDropTableIfExistsStatement(String tableName)
Forms the drop table statement specific for a certain RDBMS.String
getEndQuote()
String
getExtraOptionIndicator()
Map<String,String>
getExtraOptions()
String
getExtraOptionSeparator()
String
getExtraOptionsHelpText()
String
getExtraOptionValueSeparator()
List<RowMetaAndData>
getFeatureSummary()
String
getFieldDefinition(ValueMetaInterface v, String tk, String pk, boolean use_autoinc)
String
getFieldDefinition(ValueMetaInterface v, String tk, String pk, boolean use_autoinc, boolean add_fieldname, boolean add_cr)
String
getFunctionAverage()
String
getFunctionCount()
String
getFunctionMaximum()
String
getFunctionMinimum()
String
getFunctionSum()
protected LogChannelInterface
getGeneralLogger()
For testingString
getHostname()
Return the hostname of the machine on which the database runs.String
getIndexTablespace()
int
getInitialPoolSize()
String
getInitialPoolSizeString()
String
getLimitClause(int nrRows)
int
getMaxColumnsInIndex()
int
getMaximumPoolSize()
String
getMaximumPoolSizeString()
int
getMaxTextFieldLength()
Get the maximum length of a text field for this database connection.String
getModifyColumnStatement(String tablename, ValueMetaInterface v, String tk, boolean use_autoinc, String pk, boolean semicolon)
String
getName()
Returns the name of the database connectionString
getNamedCluster()
Long
getNextBatchId(Database ldb, String schemaName, String tableName, String fieldName)
int
getNotFoundTK(boolean use_autoinc)
int
getNrReservedWords(RowMetaInterface fields)
Checks the fields specified for reserved wordsObjectId
getObjectId()
Returns the database ID of this database connection if a repository was used before.ObjectRevision
getObjectRevision()
Gets the object revision.VariableSpace
getParentVariableSpace()
Get the parent of the variable space.PartitionDatabaseMeta[]
getPartitioningInformation()
PartitionDatabaseMeta
getPartitionMeta(String partitionId)
Finds the partition metadata for the given partition iDString
getPassword()
Get the password to log into the database on this connection.String
getPluginId()
The plugin ID of the database interfacestatic int
getPortForDBType(String strtype, String straccess)
String
getPreferredSchemaName()
String
getQuotedSchemaTableCombination(String schemaName, String tableName)
Calculate the schema-table combination, usually this is the schema and table separated with a dot.RepositoryDirectoryInterface
getRepositoryDirectory()
Not used in this case, simply return root /RepositoryObjectType
getRepositoryElementType()
Gets the repository element type for this object.String[]
getReservedWords()
ResultSet
getSchemas(DatabaseMetaData databaseMetaData)
String
getSchemaTableCombination(String schemaName, String tableName)
Deprecated.please use getQuotedSchemaTableCombination()String
getSeqNextvalSQL(String sequenceName)
String
getSequenceNoMaxValueOption()
String
getServername()
String
getSQLColumnExists(String columnname, String tablename)
String
getSQLCurrentSequenceValue(String sequenceName)
String
getSQLInsertAutoIncUnknownDimensionRow(String schemaTable, String keyField, String versionField)
Get the SQL to insert a new empty unknown record in a dimension.String
getSQLListOfProcedures()
String
getSQLListOfSchemas()
String
getSQLListOfSequences()
String
getSQLLockTables(String[] tableNames)
String
getSQLQueryFields(String tableName)
String
getSQLSequenceExists(String sequenceName)
String
getSQLServerInstance()
String
getSQLTableExists(String tablename)
String
getSQLUnlockTables(String[] tableNames)
String
getStartQuote()
String[]
getSynonymTypes()
ResultSet
getTables(DatabaseMetaData databaseMetaData, String schema, String table, String[] tableTypesToGet)
String[]
getTableTypes()
String
getTruncateTableStatement(String schema, String tableName)
String
getURL()
String
getURL(String partitionId)
String
getUsername()
Get the username to log into the database on this connection.Object
getValueFromResultSet(ResultSet rs, ValueMetaInterface val, int i)
String
getVariable(String variableName)
Get the value of a variable.String
getVariable(String variableName, String defaultValue)
Get the value of a variable with a default in case the variable is not found.String[]
getViewTypes()
String
getXML()
Describes the Object implementing this interface as XMLboolean
hasChanged()
boolean
hasDotInField(String fieldname)
int
hashCode()
boolean
hasSpacesInField(String fieldname)
Detects if a field has spaces in the name.boolean
hasSpecialCharInField(String fieldname)
Detects if a field has spaces in the name.static int
indexOfName(String[] databaseNames, String name)
static void
init()
void
initializeVariablesFrom(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()).void
injectVariables(Map<String,String> prop)
Inject variables.boolean
isClob(ValueMetaInterface v)
boolean
isDisplaySizeTwiceThePrecision()
boolean
isExplorable()
boolean
isFetchSizeSupported()
boolean
isForcingIdentifiersToLowerCase()
boolean
isForcingIdentifiersToUpperCase()
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 wordboolean
isMySQLVariant()
boolean
isNeedUpdate()
boolean
isPartitioned()
boolean
isQuoteAllFields()
boolean
isReadOnly()
Marker used to determine if the DatabaseMeta should be allowed to be modified/saved.boolean
isRequiringTransactionsOnQueries()
boolean
isReservedWord(String word)
Returns true if the string specified is a reserved word on this database type.boolean
isStreamingResults()
boolean
isSystemTable(String tableName)
boolean
isUsingConnectionPool()
boolean
isUsingDoubleDecimalAsSchemaTableSeparator()
String[]
listVariables()
List the variables (not the values) that are currently in the variable space.boolean
needsPlaceHolder()
Indicates the need to insert a placeholder (0) for auto increment fields.boolean
needsToLockAllTables()
boolean
preserveReservedCase()
String
quoteField(String field)
Returns a quoted field if this is needed: contains spaces, is a reserved word, ...boolean
quoteReservedWords()
void
quoteReservedWords(RowMetaInterface fields)
Changes the names of the fields to their quoted equivalent if this is neededString
quoteSQLString(String string)
void
replaceMeta(DatabaseMeta databaseMeta)
void
replaceMeta(DatabaseMeta databaseMeta, boolean cloneUpdateFlag)
boolean
replaceReservedWords(RowMetaInterface fields)
Checks the fields specified for reserved words and quotes them.boolean
requiresCastToVariousForIsNull()
boolean
requiresCreateTablePrimaryKeyAppend()
void
setAccessType(int access_type)
Set the type of database access.void
setAttributes(Properties attributes)
Set extra attributes on this database connectionvoid
setChanged()
void
setChanged(boolean ch)
void
setConnectionPoolingProperties(Properties properties)
void
setConnectSQL(String sql)
void
setDatabaseInterface(DatabaseInterface databaseInterface)
Set the system dependend database interface for this database metadata definitionvoid
setDatabaseType(String type)
void
setDataTablespace(String data_tablespace)
void
setDBName(String databaseName)
Set the name of the database.void
setDBPort(String db_port)
Sets the port on which the database listens.void
setDefault()
Set default values for an Oracle database.void
setDescription(String description)
Sets the description of the repository object.void
setDisplayName(String displayName)
void
setForcingIdentifiersToLowerCase(boolean forceLowerCase)
void
setForcingIdentifiersToUpperCase(boolean forceUpperCase)
void
setHostname(String hostname)
Sets the hostname of the machine on which the database runs.void
setIndexTablespace(String index_tablespace)
void
setInitialPoolSize(int initalPoolSize)
void
setInitialPoolSizeString(String initalPoolSize)
void
setMaximumPoolSize(int maximumPoolSize)
void
setMaximumPoolSizeString(String maximumPoolSize)
void
setName(String name)
Sets the name of the database connection.void
setNamedCluster(String namedCluster)
void
setNeedUpdate(boolean needUpdate)
void
setObjectId(ObjectId id)
Sets the database ID in the repository for this object.void
setObjectRevision(ObjectRevision objectRevision)
Sets the object revision.void
setParentVariableSpace(VariableSpace parent)
Set the parent variable spacevoid
setPartitioned(boolean partitioned)
void
setPartitioningInformation(PartitionDatabaseMeta[] partitionInfo)
void
setPassword(String password)
Sets the password to log into the database on this connection.void
setPreferredSchemaName(String preferredSchemaName)
void
setPreserveReservedCase(boolean b)
void
setQuoteAllFields(boolean quoteAllFields)
void
setReadOnly(boolean readOnly)
Sets the marker used to determine if the DatabaseMeta should be allowed to be modified/saved.void
setRepositoryDirectory(RepositoryDirectoryInterface repositoryDirectory)
void
setServername(String servername)
void
setSQLServerInstance(String instanceName)
void
setStreamingResults(boolean useStreaming)
void
setSupportsBooleanDataType(boolean b)
void
setSupportsTimestampDataType(boolean b)
void
setUsername(String username)
Sets the username to log into the database on this connection.void
setUsingConnectionPool(boolean usePool)
void
setUsingDoubleDecimalAsSchemaTableSeparator(boolean useDoubleDecimalSeparator)
void
setValues(String name, String type, String access, String host, String db, String port, String user, String pass)
void
setValues(DatabaseMeta info)
void
setVariable(String variableName, String variableValue)
Sets a variable in the Kettle Variables list.void
shareVariablesWith(VariableSpace space)
Share a variable space from another variable space.String
stripCR(String sbsql)
String
stripCR(StringBuffer sbsql)
String
stripCR(StringBuilder sbsql)
boolean
supportsAutoGeneratedKeys()
boolean
supportsAutoinc()
boolean
supportsBatchUpdates()
boolean
supportsBitmapIndex()
boolean
supportsBooleanDataType()
boolean
supportsCatalogs()
boolean
supportsEmptyTransactions()
boolean
supportsErrorHandlingOnBatchUpdates()
boolean
supportsFloatRoundingOnUpdate()
boolean
supportsGetBlob()
boolean
supportsOptionsInURL()
boolean
supportsPreparedStatementMetadataRetrieval()
boolean
supportsSchemas()
boolean
supportsSequenceNoMaxValueOption()
boolean
supportsSequences()
boolean
supportsSetCharacterStream()
See if this database supports the setCharacterStream() method on a PreparedStatement.boolean
supportsSetLong()
boolean
supportsSetMaxRows()
boolean
supportsSynonyms()
boolean
supportsTimestampDataType()
boolean
supportsTimeStampToDateConversion()
boolean
supportsTransactions()
Deprecated.because the same database can support transactions or not.boolean
supportsViews()
String
testConnection()
DatabaseTestResults
testConnectionSuccess()
String
toString()
boolean
useSchemaNameForTableList()
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.-
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 inconnection
tags.- 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:
getObjectId
in interfaceRepositoryElementInterface
- Specified by:
getObjectId
in interfaceRepositoryObjectInterface
- Returns:
- the ID of the db connection.
-
setObjectId
public void setObjectId(ObjectId id)
Description copied from interface:RepositoryElementInterface
Sets the database ID in the repository for this object.- Specified by:
setObjectId
in 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:
setName
in interfaceRepositoryElementInterface
- Parameters:
name
- The name of the database connection
-
getName
public String getName()
Returns the name of the database connection- Specified by:
getName
in interfaceRepositoryElementInterface
- Specified by:
getName
in interfaceRepositoryObjectInterface
- Specified by:
getName
in 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:XMLInterface
Describes the Object implementing this interface as XML- Specified by:
getXML
in interfaceSharedObjectInterface
- Specified by:
getXML
in 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 ofprimary
is the same as plugin id ofsecondary
2.secondary
is 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:VariableSpace
Copy the variables from another space, without initializing with the defaults. This does not affect any parent relationship.- Specified by:
copyVariablesFrom
in interfaceVariableSpace
- Parameters:
space
- the space to copy the variables from.
-
environmentSubstitute
public String environmentSubstitute(String aString)
Description copied from interface:VariableSpace
Substitute the string using the current variable space.- Specified by:
environmentSubstitute
in interfaceVariableSpace
- Parameters:
aString
- The string to substitute.- Returns:
- The substituted string.
-
environmentSubstitute
public String[] environmentSubstitute(String[] aString)
Description copied from interface:VariableSpace
Replaces environment variables in an array of strings. See also: environmentSubstitute(String string)- Specified by:
environmentSubstitute
in 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:VariableSpace
Substitutes 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:
fieldSubstitute
in 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:VariableSpace
Get the parent of the variable space.- Specified by:
getParentVariableSpace
in interfaceVariableSpace
- Returns:
- the parent.
-
setParentVariableSpace
public void setParentVariableSpace(VariableSpace parent)
Description copied from interface:VariableSpace
Set the parent variable space- Specified by:
setParentVariableSpace
in interfaceVariableSpace
- Parameters:
parent
- The parent variable space to set
-
getVariable
public String getVariable(String variableName, String defaultValue)
Description copied from interface:VariableSpace
Get the value of a variable with a default in case the variable is not found.- Specified by:
getVariable
in 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:VariableSpace
Get the value of a variable.- Specified by:
getVariable
in 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:VariableSpace
This 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:
getBooleanValueOfVariable
in 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:VariableSpace
Initialize 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:
initializeVariablesFrom
in interfaceVariableSpace
- Parameters:
parent
- the parent to start from, or null if root.
-
listVariables
public String[] listVariables()
Description copied from interface:VariableSpace
List the variables (not the values) that are currently in the variable space.- Specified by:
listVariables
in interfaceVariableSpace
- Returns:
- Array of String variable names.
-
setVariable
public void setVariable(String variableName, String variableValue)
Description copied from interface:VariableSpace
Sets a variable in the Kettle Variables list.- Specified by:
setVariable
in 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:VariableSpace
Share a variable space from another variable space. This means that the object should take over the space used as argument.- Specified by:
shareVariablesWith
in interfaceVariableSpace
- Parameters:
space
- Variable space to be shared.
-
injectVariables
public void injectVariables(Map<String,String> prop)
Description copied from interface:VariableSpace
Inject 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:
injectVariables
in 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:
getRepositoryDirectory
in interfaceRepositoryElementInterface
-
setRepositoryDirectory
public void setRepositoryDirectory(RepositoryDirectoryInterface repositoryDirectory)
- Specified by:
setRepositoryDirectory
in interfaceRepositoryElementInterface
-
getRepositoryElementType
public RepositoryObjectType getRepositoryElementType()
Description copied from interface:RepositoryElementInterface
Gets the repository element type for this object.- Specified by:
getRepositoryElementType
in interfaceRepositoryElementInterface
- Returns:
- the repository element type for this object
-
getObjectRevision
public ObjectRevision getObjectRevision()
Description copied from interface:RepositoryElementInterface
Gets the object revision.- Specified by:
getObjectRevision
in interfaceRepositoryElementInterface
- Returns:
- the object revision
-
setObjectRevision
public void setObjectRevision(ObjectRevision objectRevision)
Description copied from interface:RepositoryElementInterface
Sets the object revision.- Specified by:
setObjectRevision
in interfaceRepositoryElementInterface
-
getDescription
public String getDescription()
Description copied from interface:RepositoryElementInterface
Gets the description of the repository object.- Specified by:
getDescription
in interfaceRepositoryElementInterface
- Returns:
-
setDescription
public void setDescription(String description)
Description copied from interface:RepositoryElementInterface
Sets the description of the repository object.- Specified by:
setDescription
in 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)
-
-