Top Description Fields Constructors Methods
org.eclipse.persistence.platform.database

public Class DB2Platform

extends DatabasePlatform
Class Inheritance
Known Direct Subclasses
org.eclipse.persistence.platform.database.DB2ZPlatform, org.eclipse.persistence.platform.database.DerbyPlatform, org.eclipse.persistence.platform.database.DB2MainframePlatform
Imports
java.io.*, java.sql.*, java.util.*, org.eclipse.persistence.exceptions.ValidationException, org.eclipse.persistence.expressions.*, org.eclipse.persistence.internal.helper.*, org.eclipse.persistence.internal.sessions.AbstractRecord, .AbstractSession, org.eclipse.persistence.internal.databaseaccess.DatabaseCall, .DatasourceCall.ParameterType, .FieldTypeDefinition, org.eclipse.persistence.internal.expressions.ConstantExpression, .ExpressionJavaPrinter, .ExpressionSQLPrinter, .ParameterExpression, .SQLSelectStatement, org.eclipse.persistence.queries.*, org.eclipse.persistence.tools.schemaframework.FieldDefinition

Purpose: Provides DB2 specific behavior.

Responsibilities:

Since
TOPLink/Java 1.0

Field Summary

Inherited from org.eclipse.persistence.platform.database.DatabasePlatform:
DEFAULT_VARCHAR_SIZE

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
allowBindingForSelectClause()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.allowBindingForSelectClause.

INTERNAL: DB2 does not allow stand alone, untyped parameter markers in select clause.
protected void
appendByteArray(byte[] bytes, Writer writer)

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.appendByteArray.

INTERNAL: Append a byte[] in native DB@ format BLOB(hexString) if usesNativeSQL(), otherwise use ODBC format from DatabasePLatform.
protected void
appendCalendar(Calendar calendar, Writer writer)

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.appendCalendar.

INTERNAL: Append the Timestamp in native format if usesNativeSQL() is true otherwise use ODBC format from DatabasePlatform.
protected void
appendDate(Date date, Writer writer)

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.appendDate.

INTERNAL: Appends the Date in native format if usesNativeSQL() otherwise use ODBC format from DatabasePlatform.
protected void
appendDB2Calendar(Calendar calendar, Writer writer)

Write a timestamp in DB2 specific format (yyyy-mm-dd-hh.mm.ss.ffffff).

protected void
appendDB2Date(Date date, Writer writer)

INTERNAL: Write a timestamp in DB2 specific format (mm/dd/yyyy).

protected void
appendDB2Timestamp(Timestamp timestamp, Writer writer)

INTERNAL: Write a timestamp in DB2 specific format (yyyy-mm-dd-hh.mm.ss.ffffff).

protected void
appendTime(Time time, Writer writer)

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.appendTime.

INTERNAL: Append the Time in Native format if usesNativeSQL() otherwise use ODBC format from DAtabasePlatform.
protected void
appendTimestamp(Timestamp timestamp, Writer writer)

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.appendTimestamp.

INTERNAL: Append the Timestamp in native format if usesNativeSQL() is true otherwise use ODBC format from DatabasePlatform.
protected ExpressionOperator
ascendingOperator()

Disable binding support.

protected Hashtable<Class<?>, FieldTypeDefinition>
buildFieldTypes()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.buildFieldTypes.

Return the mapping of class types to database types for the schema framework.
public ValueReadQuery
public ValueReadQuery
protected ExpressionOperator
caseConditionOperator()

DB2 does not allow untyped parameter binding for the THEN & ELSE 'result-expressions' of CASE expressions

With binding enabled, DB2 & DB2 z/OS will throw an error:

The statement cannot be executed because a parameter marker has been used 
in an invalid way.
protected ExpressionOperator
caseOperator()

DB2 does not allow untyped parameter binding for the THEN & ELSE 'result-expressions' of CASE expressions

With binding enabled, DB2 & DB2 z/OS will throw an error:

The statement cannot be executed because a parameter marker has been used 
in an invalid way.
protected ExpressionOperator
coalesceOperator()

DB2 requires that at least one argument be a known type

With binding enabled, DB2 will throw an error:

The statement cannot be executed because a parameter marker has been used 
in an invalid way.
protected ExpressionOperator
concatOperator()

INTERNAL: The concat operator is of the form ....

protected ExpressionOperator
count()

Disable binding support.

protected ExpressionOperator
descendingOperator()

Disable binding support.

protected static ExpressionOperator
disableAllBindingExpression()

Create an ExpressionOperator that disables all parameter binding

protected static ExpressionOperator
disableAtLeast1BindingExpression()

Create an ExpressionOperator that requires at least 1 typed argument

protected ExpressionOperator
distinct()

Disable binding support.

public boolean
protected String
getCreateTempTableSqlBodyForTable(DatabaseTable
is original table for which temp table is created.
table
)

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.getCreateTempTableSqlBodyForTable.

INTERNAL: DB2 allows LIKE to be used to create temp tables, which avoids having to know the types.
protected String
protected String
public int
getMaxFieldNameSize()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.getMaxFieldNameSize.

INTERNAL: returns the maximum number of characters that can be used in a field name on this platform.
public int
getMaxForeignKeyNameSize()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.getMaxForeignKeyNameSize.

INTERNAL: returns the maximum number of characters that can be used in a foreign key name on this platform.
public int
getMaxUniqueKeyNameSize()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.getMaxUniqueKeyNameSize.

INTERNAL: returns the maximum number of characters that can be used in a unique key name on this platform.
public Vector<E>
getNativeTableInfo(String table, String creator, AbstractSession session)

INTERNAL: Return the catalog information through using the native SQL catalog selects.

public String
public String
public String
public String
public String
public String
public String
public DatabaseTable
getTempTableForTable(DatabaseTable
is original table for which temp table is created.
table
)

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.getTempTableForTable.

INTERNAL: DB2 temp table syntax.
public ValueReadQuery
public void
protected void
public boolean
public boolean
public boolean
isDynamicSQLRequiredForFunctions()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.isDynamicSQLRequiredForFunctions.

INTERNAL DB2 has some issues with using parameters on certain functions and relations.
public boolean
protected ExpressionOperator
lengthOperator()

Disable binding support.

protected ExpressionOperator
ltrim2Operator()

DB2 does not support untyped parameter binding for <operand2>

With binding enabled, DB2 & DB2 z/OS will throw an error:

The statement cannot be executed because a parameter marker has been used 
in an invalid way.
protected ExpressionOperator
max()

Disable binding support.

public Hashtable<Class<? extends Number>, ? super Number>
maximumNumericValues()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.maximumNumericValues.

INTERNAL: Builds a table of maximum numeric values keyed on java class.
protected ExpressionOperator
min()

Disable binding support.

public Hashtable<Class<? extends Number>, ? super Number>
minimumNumericValues()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.minimumNumericValues.

INTERNAL: Builds a table of minimum numeric values keyed on java class.
protected ExpressionOperator
nullifOperator()

DB2 requires that at least one argument be a known type

With binding enabled, DB2 & DB2 z/OS will throw an error:

The statement cannot be executed because a parameter marker has been used 
in an invalid way.
public void
printFieldIdentityClause(Writer writer)

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.printFieldIdentityClause.

INTERNAL: Append the receiver's field 'identity' constraint clause to a writer.
protected void
public void
printSQLSelectStatement(DatabaseCall call, ExpressionSQLPrinter printer, SQLSelectStatement statement)

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.printSQLSelectStatement.

INTERNAL: Print the SQL representation of the statement on a stream, storing the fields in the DatabaseCall.
protected ExpressionOperator
roundOperator()

DB2 requires that at least one argument be a known type

With binding enabled, DB2 will throw an error:

Db2 cannot determine how to implicitly cast the arguments between string and 
numeric data types.
protected ExpressionOperator
rtrim2Operator()

DB2 does not support untyped parameter binding for <operand2>

With binding enabled, DB2 & DB2 z/OS will throw an error:

The statement cannot be executed because a parameter marker has been used 
in an invalid way.
public boolean
shouldBindPartialParameters()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.shouldBindPartialParameters.

Used to determine if the platform should perform partial parameter binding or not Enabled for DB2 and DB2 for zOS to add support for partial binding
public boolean
public boolean
public boolean
shouldPrintOutputTokenAtStart()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.shouldPrintOutputTokenAtStart.

INTERNAL: This is required in the construction of the stored procedures with output parameters.
public boolean
shouldUseJDBCOuterJoinSyntax()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.shouldUseJDBCOuterJoinSyntax.

INTERNAL: JDBC defines and outer join syntax, many drivers do not support this.
public boolean
public boolean
supportsIdentity()

Overrides org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform.supportsIdentity.

INTERNAL: Indicates whether the platform supports identity.
public boolean
public boolean
public boolean
protected ExpressionOperator
trim2()

DB2 does not support untyped parameter binding for <operand2>

With binding enabled, DB2 & DB2 z/OS will throw an error:

The statement cannot be executed because a parameter marker has been used 
in an invalid way.
public void
writeParameterMarker(Writer writer, ParameterExpression parameter, AbstractRecord record, DatabaseCall call)

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.writeParameterMarker.

INTERNAL: DB2 requires casting on certain operations, such as the CONCAT function, and parameterized queries of the form, ":param = :param".

Constructor Detail

DB2Platformback to summary
public DB2Platform()

Method Detail

allowBindingForSelectClauseback to summary
public boolean allowBindingForSelectClause()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.allowBindingForSelectClause.

INTERNAL: DB2 does not allow stand alone, untyped parameter markers in select clause.

Annotations
@Override
See Also
org.eclipse.persistence.internal.expressions.ConstantExpression#writeFields(ExpressionSQLPrinter, List, SQLSelectStatement), org.eclipse.persistence.internal.expressions.ParameterExpression#writeFields(ExpressionSQLPrinter, List, SQLSelectStatement)
appendByteArrayback to summary
protected void appendByteArray(byte[] bytes, Writer writer) throws IOException

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.appendByteArray.

INTERNAL: Append a byte[] in native DB@ format BLOB(hexString) if usesNativeSQL(), otherwise use ODBC format from DatabasePLatform.

Annotations
@Override
appendCalendarback to summary
protected void appendCalendar(Calendar calendar, Writer writer) throws IOException

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.appendCalendar.

INTERNAL: Append the Timestamp in native format if usesNativeSQL() is true otherwise use ODBC format from DatabasePlatform. Native format: 'YYYY-MM-DD-hh.mm.ss.SSSSSS'

Annotations
@Override
appendDateback to summary
protected void appendDate(Date date, Writer writer) throws IOException

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.appendDate.

INTERNAL: Appends the Date in native format if usesNativeSQL() otherwise use ODBC format from DatabasePlatform. Native format: 'mm/dd/yyyy'

Annotations
@Override
appendDB2Calendarback to summary
protected void appendDB2Calendar(Calendar calendar, Writer writer) throws IOException

Write a timestamp in DB2 specific format (yyyy-mm-dd-hh.mm.ss.ffffff).

appendDB2Dateback to summary
protected void appendDB2Date(Date date, Writer writer) throws IOException

INTERNAL: Write a timestamp in DB2 specific format (mm/dd/yyyy).

appendDB2Timestampback to summary
protected void appendDB2Timestamp(Timestamp timestamp, Writer writer) throws IOException

INTERNAL: Write a timestamp in DB2 specific format (yyyy-mm-dd-hh.mm.ss.ffffff).

appendTimeback to summary
protected void appendTime(Time time, Writer writer) throws IOException

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.appendTime.

INTERNAL: Append the Time in Native format if usesNativeSQL() otherwise use ODBC format from DAtabasePlatform. Native Format: 'hh:mm:ss'

Annotations
@Override
appendTimestampback to summary
protected void appendTimestamp(Timestamp timestamp, Writer writer) throws IOException

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.appendTimestamp.

INTERNAL: Append the Timestamp in native format if usesNativeSQL() is true otherwise use ODBC format from DatabasePlatform. Native format: 'YYYY-MM-DD-hh.mm.ss.SSSSSS'

Annotations
@Override
ascendingOperatorback to summary
protected ExpressionOperator ascendingOperator()

Disable binding support.

With binding enabled, DB2 & DB2 z/OS will throw an error:

The statement cannot be executed because a parameter marker has been used 
in an invalid way. DB2 SQL Error: SQLCODE=-418, SQLSTATE=42610

With binding enabled, Derby will throw an error:

ERROR 42X34: There is a ? parameter in the select list. This is not allowed.
buildFieldTypesback to summary
protected Hashtable<Class<?>, FieldTypeDefinition> buildFieldTypes()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.buildFieldTypes.

Doc from org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.buildFieldTypes.

Return the mapping of class types to database types for the schema framework.

Annotations
@Override
buildSelectQueryForIdentityback to summary
public ValueReadQuery buildSelectQueryForIdentity()

Overrides org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform.buildSelectQueryForIdentity.

INTERNAL: Build the identity query for native sequencing.

Annotations
@Override
buildSelectQueryForSequenceObjectback to summary
public ValueReadQuery buildSelectQueryForSequenceObject(String qualifiedSeqName, Integer size)

Overrides org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform.buildSelectQueryForSequenceObject.

INTERNAL: DB2 added SEQUENCE support as of (I believe) v8.

Annotations
@Override
caseConditionOperatorback to summary
protected ExpressionOperator caseConditionOperator()

DB2 does not allow untyped parameter binding for the THEN & ELSE 'result-expressions' of CASE expressions

With binding enabled, DB2 & DB2 z/OS will throw an error:

The statement cannot be executed because a parameter marker has been used 
in an invalid way. DB2 SQL Error: SQLCODE=-418, SQLSTATE=42610
Examples of places where parameter markers cannot be used:
  • In a result-expression in any CASE expression when all the other result-expressions are either NULL or untyped parameter markers

With binding enabled, Derby will throw an error:

ERROR 42X87: At least one result expression (THEN or ELSE) of the CASE expression must have a known type.
caseOperatorback to summary
protected ExpressionOperator caseOperator()

DB2 does not allow untyped parameter binding for the THEN & ELSE 'result-expressions' of CASE expressions

With binding enabled, DB2 & DB2 z/OS will throw an error:

The statement cannot be executed because a parameter marker has been used 
in an invalid way. DB2 SQL Error: SQLCODE=-418, SQLSTATE=42610
Examples of places where parameter markers cannot be used:
  • In a result-expression in any CASE expression when all the other result-expressions are either NULL or untyped parameter markers

With binding enabled, Derby will throw an error:

ERROR 42X87: At least one result expression (THEN or ELSE) of the CASE expression must have a known type.
coalesceOperatorback to summary
protected ExpressionOperator coalesceOperator()

DB2 requires that at least one argument be a known type

With binding enabled, DB2 will throw an error:

The statement cannot be executed because a parameter marker has been used 
in an invalid way. DB2 SQL Error: SQLCODE=-418, SQLSTATE=42610

With binding enabled, DB2 z/OS will throw an error:

The statement string specified as the object of a PREPARE contains a 
predicate or expression where parameter markers have been used as operands of 
the same operator—for example: ? > ?. DB2 SQL Error: SQLCODE=-417, SQLSTATE=42609

With binding enabled, Derby will throw an error:

ERROR 42610: All the arguments to the COALESCE/VALUE function cannot be parameters. The function needs at least one argument that is not a parameter.
concatOperatorback to summary
protected ExpressionOperator concatOperator()

INTERNAL: The concat operator is of the form .... VARCHAR ( <operand1> || <operand2> )

countback to summary
protected ExpressionOperator count()

Disable binding support.

With binding enabled, DB2 will throw an error:

Db2 cannot determine how to implicitly cast the arguments between string and 
numeric data types. DB2 SQL Error: SQLCODE=-245, SQLSTATE=428F5

With binding enabled, DB2 z/OS will throw an error:

The statement cannot be executed because a parameter marker has been used 
in an invalid way. DB2 SQL Error: SQLCODE=-418, SQLSTATE=42610

With binding enabled, Derby will throw an error:

ERROR 42X36: The 'COUNT' operator is not allowed to take a ? parameter as an operand.
descendingOperatorback to summary
protected ExpressionOperator descendingOperator()

Disable binding support.

With binding enabled, DB2 & DB2 z/OS will throw an error:

The statement cannot be executed because a parameter marker has been used 
in an invalid way. DB2 SQL Error: SQLCODE=-418, SQLSTATE=42610

With binding enabled, Derby will throw an error:

ERROR 42X34: There is a ? parameter in the select list. This is not allowed.
disableAllBindingExpressionback to summary
protected static ExpressionOperator disableAllBindingExpression()

Create an ExpressionOperator that disables all parameter binding

disableAtLeast1BindingExpressionback to summary
protected static ExpressionOperator disableAtLeast1BindingExpression()

Create an ExpressionOperator that requires at least 1 typed argument

distinctback to summary
protected ExpressionOperator distinct()

Disable binding support.

With binding enabled, DB2 will throw an error:

Db2 cannot determine how to implicitly cast the arguments between string and 
numeric data types. DB2 SQL Error: SQLCODE=-245, SQLSTATE=428F5

With binding enabled, DB2 & DB2 z/OS will throw an error:

The statement cannot be executed because a parameter marker has been used 
in an invalid way. DB2 SQL Error: SQLCODE=-418, SQLSTATE=42610

With binding enabled, Derby will throw an error:

ERROR 42X34: There is a ? parameter in the select list.  This is not allowed.
dontBindUpdateAllQueryUsingTempTablesback to summary
public boolean dontBindUpdateAllQueryUsingTempTables()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.dontBindUpdateAllQueryUsingTempTables.

INTERNAL: DB2 has issues with binding with temp table queries. This is used by UpdateAllQuerys.

Annotations
@Override
getCreateTempTableSqlBodyForTableback to summary
protected String getCreateTempTableSqlBodyForTable(DatabaseTable table)

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.getCreateTempTableSqlBodyForTable.

INTERNAL: DB2 allows LIKE to be used to create temp tables, which avoids having to know the types. This is used by UpdateAllQuerys.

Parameters
table:DatabaseTable

Doc from org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.getCreateTempTableSqlBodyForTable.

is original table for which temp table is created.

Returns:String

Doc from org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.getCreateTempTableSqlBodyForTable.

String

Annotations
@Override
getCreateTempTableSqlPrefixback to summary
protected String getCreateTempTableSqlPrefix()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.getCreateTempTableSqlPrefix.

INTERNAL: DB2 temp table syntax. This is used by UpdateAllQuerys.

Annotations
@Override
getCreateTempTableSqlSuffixback to summary
protected String getCreateTempTableSqlSuffix()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.getCreateTempTableSqlSuffix.

INTERNAL: DB2 temp table syntax. This is used by UpdateAllQuerys.

Annotations
@Override
getMaxFieldNameSizeback to summary
public int getMaxFieldNameSize()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.getMaxFieldNameSize.

INTERNAL: returns the maximum number of characters that can be used in a field name on this platform.

Annotations
@Override
getMaxForeignKeyNameSizeback to summary
public int getMaxForeignKeyNameSize()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.getMaxForeignKeyNameSize.

INTERNAL: returns the maximum number of characters that can be used in a foreign key name on this platform.

Annotations
@Override
getMaxUniqueKeyNameSizeback to summary
public int getMaxUniqueKeyNameSize()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.getMaxUniqueKeyNameSize.

INTERNAL: returns the maximum number of characters that can be used in a unique key name on this platform.

Annotations
@Override
getNativeTableInfoback to summary
public Vector<E> getNativeTableInfo(String table, String creator, AbstractSession session)

INTERNAL: Return the catalog information through using the native SQL catalog selects. This is required because many JDBC driver do not support meta-data. Wildcards can be passed as arguments. This is currently not used.

getNoWaitStringback to summary
public String getNoWaitString()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.getNoWaitString.

INTERNAL: DB2 does not support NOWAIT.

Annotations
@Override
getProcedureArgumentback to summary
public String getProcedureArgument(String name, Object parameter, DatasourceCall.ParameterType parameterType, StoredProcedureCall call, AbstractSession session)

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.getProcedureArgument.

Obtain the platform specific argument string

Annotations
@Override
getProcedureAsStringback to summary
public String getProcedureAsString()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.getProcedureAsString.

INTERNAL: Used for stored procedure defs.

Annotations
@Override
getProcedureBeginStringback to summary
public String getProcedureBeginString()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.getProcedureBeginString.

Used for stored procedure defs.

Annotations
@Override
getProcedureCallHeaderback to summary
public String getProcedureCallHeader()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.getProcedureCallHeader.

INTERNAL: Used for sp calls.

Annotations
@Override
getProcedureEndStringback to summary
public String getProcedureEndString()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.getProcedureEndString.

INTERNAL: Used for stored procedure defs.

Annotations
@Override
getSelectForUpdateStringback to summary
public String getSelectForUpdateString()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.getSelectForUpdateString.

INTERNAL: Used for pessimistic locking in DB2. Without the "WITH RS" the lock is not held.

Annotations
@Override
getTempTableForTableback to summary
public DatabaseTable getTempTableForTable(DatabaseTable table)

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.getTempTableForTable.

INTERNAL: DB2 temp table syntax. This is used by UpdateAllQuerys.

Parameters
table:DatabaseTable

Doc from org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.getTempTableForTable.

is original table for which temp table is created.

Returns:DatabaseTable

Doc from org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.getTempTableForTable.

temporary table

Annotations
@Override
getTimestampQueryback to summary
public ValueReadQuery getTimestampQuery()

Overrides org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform.getTimestampQuery.

Implements org.eclipse.persistence.internal.databaseaccess.Platform.getTimestampQuery.

INTERNAL: This method returns the query to select the timestamp from the server for DB2.

Annotations
@Override
initializeConnectionDataback to summary
public void initializeConnectionData(Connection connection) throws SQLException

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.initializeConnectionData.

Doc from org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.initializeConnectionData.

INTERNAL: Allow initialization from the connection.

Annotations
@Override
initializePlatformOperatorsback to summary
protected void initializePlatformOperators()

Overrides org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform.initializePlatformOperators.

INTERNAL: Initialize any platform-specific operators

Annotations
@Override
isAlterSequenceObjectSupportedback to summary
public boolean isAlterSequenceObjectSupported()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.isAlterSequenceObjectSupported.

INTERNAL: DB2 added SEQUENCE support as of (I believe) v8.

Annotations
@Override
isDB2back to summary
public boolean isDB2()

Overrides org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform.isDB2.

Implements org.eclipse.persistence.internal.databaseaccess.Platform.isDB2.

Annotations
@Override
isDynamicSQLRequiredForFunctionsback to summary
public boolean isDynamicSQLRequiredForFunctions()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.isDynamicSQLRequiredForFunctions.

INTERNAL DB2 has some issues with using parameters on certain functions and relations. This allows statements to disable binding only in these cases. If users set casting on, then casting is used instead of dynamic SQL.

Annotations
@Override
isNullAllowedInSelectClauseback to summary
public boolean isNullAllowedInSelectClause()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.isNullAllowedInSelectClause.

INTERNAL: DB2 does not allow NULL in select clause. This is used by UpdateAllQuerys.

Annotations
@Override
lengthOperatorback to summary
protected ExpressionOperator lengthOperator()

Disable binding support.

With binding enabled, DB2 will throw an error:

Db2 cannot determine how to implicitly cast the arguments between string and 
numeric data types. DB2 SQL Error: SQLCODE=-245, SQLSTATE=428F5

With binding enabled, DB2 z/OS will throw an error:

The statement cannot be executed because a parameter marker has been used 
in an invalid way. DB2 SQL Error: SQLCODE=-418, SQLSTATE=42610

With binding enabled, Derby will throw an error:

ERROR 42X36: The 'length' operator is not allowed to take a ? parameter as an operand.
ltrim2Operatorback to summary
protected ExpressionOperator ltrim2Operator()

DB2 does not support untyped parameter binding for <operand2>

With binding enabled, DB2 & DB2 z/OS will throw an error:

The statement cannot be executed because a parameter marker has been used 
in an invalid way. DB2 SQL Error: SQLCODE=-418, SQLSTATE=42610
maxback to summary
protected ExpressionOperator max()

Disable binding support.

With binding enabled, DB2 will throw an error:

Db2 cannot determine how to implicitly cast the arguments between string and 
numeric data types. DB2 SQL Error: SQLCODE=-245, SQLSTATE=428F5

With binding enabled, DB2 z/OS will throw an error:

The statement cannot be executed because a parameter marker has been used 
in an invalid way. DB2 SQL Error: SQLCODE=-418, SQLSTATE=42610

With binding enabled, Derby will throw an error:

ERROR 42X36: The 'MAX' operator is not allowed to take a ? parameter as an operand.
maximumNumericValuesback to summary
public Hashtable<Class<? extends Number>, ? super Number> maximumNumericValues()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.maximumNumericValues.

INTERNAL: Builds a table of maximum numeric values keyed on java class. This is used for type testing but might also be useful to end users attempting to sanitize values.

Note

BigInteger & BigDecimal maximums are dependent upon their precision & Scale

Annotations
@Override
minback to summary
protected ExpressionOperator min()

Disable binding support.

With binding enabled, DB2 will throw an error:

Db2 cannot determine how to implicitly cast the arguments between string and 
numeric data types. DB2 SQL Error: SQLCODE=-245, SQLSTATE=428F5

With binding enabled, DB2 z/OS will throw an error:

The statement cannot be executed because a parameter marker has been used 
in an invalid way. DB2 SQL Error: SQLCODE=-418, SQLSTATE=42610

With binding enabled, Derby will throw an error:

ERROR 42X36: The 'MIN' operator is not allowed to take a ? parameter as an operand.
minimumNumericValuesback to summary
public Hashtable<Class<? extends Number>, ? super Number> minimumNumericValues()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.minimumNumericValues.

INTERNAL: Builds a table of minimum numeric values keyed on java class. This is used for type testing but might also be useful to end users attempting to sanitize values.

Note

BigInteger & BigDecimal minimums are dependent upon their precision & Scale

Annotations
@Override
nullifOperatorback to summary
protected ExpressionOperator nullifOperator()

DB2 requires that at least one argument be a known type

With binding enabled, DB2 & DB2 z/OS will throw an error:

The statement cannot be executed because a parameter marker has been used 
in an invalid way. DB2 SQL Error: SQLCODE=-418, SQLSTATE=42610

With binding enabled, Derby will throw an error:

ERROR 42X35: It is not allowed for both operands of '=' to be ? parameters.
printFieldIdentityClauseback to summary
public void printFieldIdentityClause(Writer writer) throws ValidationException

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.printFieldIdentityClause.

INTERNAL: Append the receiver's field 'identity' constraint clause to a writer. Used by table creation with sequencing.

Annotations
@Override
printFieldTypeSizeback to summary
protected void printFieldTypeSize(Writer writer, FieldDefinition field, FieldTypeDefinition ftd) throws IOException

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.printFieldTypeSize.

Annotations
@Override
printSQLSelectStatementback to summary
public void printSQLSelectStatement(DatabaseCall call, ExpressionSQLPrinter printer, SQLSelectStatement statement)

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.printSQLSelectStatement.

INTERNAL: Print the SQL representation of the statement on a stream, storing the fields in the DatabaseCall. This implementation works MaxRows and FirstResult into the SQL using DB2's ROWNUMBER() OVER() to filter values if shouldUseRownumFiltering is true.

Annotations
@Override
roundOperatorback to summary
protected ExpressionOperator roundOperator()

DB2 requires that at least one argument be a known type

With binding enabled, DB2 will throw an error:

Db2 cannot determine how to implicitly cast the arguments between string and 
numeric data types. DB2 SQL Error: SQLCODE=-245, SQLSTATE=428F5
rtrim2Operatorback to summary
protected ExpressionOperator rtrim2Operator()

DB2 does not support untyped parameter binding for <operand2>

With binding enabled, DB2 & DB2 z/OS will throw an error:

The statement cannot be executed because a parameter marker has been used 
in an invalid way. DB2 SQL Error: SQLCODE=-418, SQLSTATE=42610
shouldBindPartialParametersback to summary
public boolean shouldBindPartialParameters()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.shouldBindPartialParameters.

Used to determine if the platform should perform partial parameter binding or not Enabled for DB2 and DB2 for zOS to add support for partial binding

Annotations
@Override
shouldIgnoreExceptionback to summary
public boolean shouldIgnoreException(SQLException exception)

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.shouldIgnoreException.

INTERNAL: Allow for the platform to ignore exceptions. This is required for DB2 which throws no-data modified as an exception.

Annotations
@Override
shouldPrintForUpdateClauseback to summary
public boolean shouldPrintForUpdateClause()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.shouldPrintForUpdateClause.

Annotations
@Override
shouldPrintOutputTokenAtStartback to summary
public boolean shouldPrintOutputTokenAtStart()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.shouldPrintOutputTokenAtStart.

INTERNAL: This is required in the construction of the stored procedures with output parameters.

Annotations
@Override
shouldUseJDBCOuterJoinSyntaxback to summary
public boolean shouldUseJDBCOuterJoinSyntax()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.shouldUseJDBCOuterJoinSyntax.

INTERNAL: JDBC defines and outer join syntax, many drivers do not support this. So we normally avoid it.

Annotations
@Override
supportsGlobalTempTablesback to summary
public boolean supportsGlobalTempTables()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.supportsGlobalTempTables.

INTERNAL: DB2 supports temp tables. This is used by UpdateAllQuerys.

Annotations
@Override
supportsIdentityback to summary
public boolean supportsIdentity()

Overrides org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform.supportsIdentity.

INTERNAL: Indicates whether the platform supports identity. DB2 does through AS IDENTITY field types. This is used by sequencing.

Annotations
@Override
supportsLockingQueriesWithMultipleTablesback to summary
public boolean supportsLockingQueriesWithMultipleTables()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.supportsLockingQueriesWithMultipleTables.

INTERNAL: DB2 does not seem to allow FOR UPDATE on queries with multiple tables. This is only used by testing to exclude these tests.

Annotations
@Override
supportsOrderByParametersback to summary
public boolean supportsOrderByParameters()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.supportsOrderByParameters.

DB2 disables single parameter usage in ORDER BY clause.

If a parameter marker is used, DB2 & DB2 z/OS will throw an error:

The statement cannot be executed because a parameter marker has been used 
in an invalid way. DB2 SQL Error: SQLCODE=-418, SQLSTATE=42610

If a parameter marker is used, Derby will throw an error:

ERROR 42X34: There is a ? parameter in the select list.  This is not allowed.
Annotations
@Override
supportsSequenceObjectsback to summary
public boolean supportsSequenceObjects()

Overrides org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform.supportsSequenceObjects.

INTERNAL: DB2 added SEQUENCE support as of (I believe) v8.

Annotations
@Override
trim2back to summary
protected ExpressionOperator trim2()

DB2 does not support untyped parameter binding for <operand2>

With binding enabled, DB2 & DB2 z/OS will throw an error:

The statement cannot be executed because a parameter marker has been used 
in an invalid way. DB2 SQL Error: SQLCODE=-418, SQLSTATE=42610
writeParameterMarkerback to summary
public void writeParameterMarker(Writer writer, ParameterExpression parameter, AbstractRecord record, DatabaseCall call) throws IOException

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.writeParameterMarker.

INTERNAL: DB2 requires casting on certain operations, such as the CONCAT function, and parameterized queries of the form, ":param = :param". This method will write CAST operation to parameters if the type is known. This is not used by default, only if isCastRequired is set to true, by default dynamic SQL is used to avoid the issue in only the required cases.

Annotations
@Override