Class DB2Platform
- All Implemented Interfaces:
Serializable
,Cloneable
,org.eclipse.persistence.internal.core.databaseaccess.CorePlatform<org.eclipse.persistence.internal.helper.ConversionManager>
,org.eclipse.persistence.internal.databaseaccess.Platform
- Direct Known Subclasses:
DB2MainframePlatform
,DB2ZPlatform
,DerbyPlatform
Purpose: Provides DB2 specific behavior.
Responsibilities:
- Support for schema creation.
- Native SQL for byte[], Date, Time, & Timestamp.
- Support for table qualified names.
- Support for stored procedures.
- Support for temp tables.
- Support for casting.
- Support for database functions.
- Support for identity sequencing.
- Support for SEQUENCE sequencing.
- See Also:
-
Field Summary
Fields inherited from class org.eclipse.persistence.platform.database.DatabasePlatform
DEFAULT_VARCHAR_SIZE
Fields inherited from class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
batchWritingMechanism, castSizeForVarcharParameter, classTypes, cursorCode, DEFAULT_MAX_BATCH_WRITING_SIZE, DEFAULT_PARAMETERIZED_MAX_BATCH_WRITING_SIZE, driverName, driverSupportsNationalCharacterVarying, fieldTypes, IS_VALID_TIMEOUT, isCastRequired, maxBatchWritingSize, partitioningCallback, pingSQL, printInnerJoinInWhereClause, printOuterJoinInWhereClause, shouldBindAllParameters, shouldBindLiterals, shouldBindPartialParameters, shouldCacheAllStatements, shouldCreateIndicesOnForeignKeys, shouldForceBindAllParameters, shouldForceFieldNamesToUpperCase, shouldIgnoreCaseOnFieldComparisons, shouldOptimizeDataConversion, shouldTrimStrings, statementCacheSize, storedProcedureTerminationToken, stringBindingSize, structConverters, supportsAutoCommit, tableCreationSuffix, transactionIsolation, typeConverters, useJDBCStoredProcedureSyntax, useNationalCharacterVarying, useRownumFiltering, usesBatchWriting, usesByteArrayBinding, usesJDBCBatchWriting, usesNativeBatchWriting, usesNativeSQL, usesStreamsForBinding, usesStringBinding
Fields inherited from class org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
conversionManager, dataTypesConvertedFromAClass, dataTypesConvertedToAClass, defaultNativeSequenceToTable, defaultSeqenceAtNextValue, defaultSequence, endDelimiter, platformOperators, sequences, sequencesLock, startDelimiter, supportsReturnGeneratedKeys, tableQualifier, timestampQuery
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
INTERNAL: DB2 does not allow stand alone, untyped parameter markers in select clause.protected void
appendByteArray
(byte[] bytes, Writer writer) 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) INTERNAL: Append the Timestamp in native format if usesNativeSQL() is true otherwise use ODBC format from DatabasePlatform.protected void
appendDate
(Date date, Writer writer) 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) INTERNAL: Append the Time in Native format if usesNativeSQL() otherwise use ODBC format from DAtabasePlatform.protected void
appendTimestamp
(Timestamp timestamp, Writer writer) INTERNAL: Append the Timestamp in native format if usesNativeSQL() is true otherwise use ODBC format from DatabasePlatform.protected ExpressionOperator
Disable binding support.protected Hashtable
Return the mapping of class types to database types for the schema framework.INTERNAL: Build the identity query for native sequencing.buildSelectQueryForSequenceObject
(String qualifiedSeqName, Integer size) INTERNAL: DB2 added SEQUENCE support as of (I believe) v8.protected ExpressionOperator
DB2 does not allow untyped parameter binding for the THEN & ELSE 'result-expressions' of CASE expressionsprotected ExpressionOperator
DB2 does not allow untyped parameter binding for the THEN & ELSE 'result-expressions' of CASE expressionsprotected ExpressionOperator
DB2 requires that at least one argument be a known typeprotected ExpressionOperator
INTERNAL: The concat operator is of the form ....protected ExpressionOperator
count()
Disable binding support.protected ExpressionOperator
Disable binding support.protected static ExpressionOperator
Create an ExpressionOperator that disables all parameter bindingprotected static ExpressionOperator
Create an ExpressionOperator that requires at least 1 typed argumentprotected ExpressionOperator
distinct()
Disable binding support.boolean
INTERNAL: DB2 has issues with binding with temp table queries.protected String
getCreateTempTableSqlBodyForTable
(org.eclipse.persistence.internal.helper.DatabaseTable table) INTERNAL: DB2 allows LIKE to be used to create temp tables, which avoids having to know the types.protected String
INTERNAL: DB2 temp table syntax.protected String
INTERNAL: DB2 temp table syntax.int
INTERNAL: returns the maximum number of characters that can be used in a field name on this platform.int
INTERNAL: returns the maximum number of characters that can be used in a foreign key name on this platform.int
INTERNAL: returns the maximum number of characters that can be used in a unique key name on this platform.getNativeTableInfo
(String table, String creator, org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Return the catalog information through using the native SQL catalog selects.INTERNAL: DB2 does not support NOWAIT.getProcedureArgument
(String name, Object parameter, org.eclipse.persistence.internal.databaseaccess.DatasourceCall.ParameterType parameterType, StoredProcedureCall call, org.eclipse.persistence.internal.sessions.AbstractSession session) Obtain the platform specific argument stringINTERNAL: Used for stored procedure defs.Used for stored procedure defs.INTERNAL: Used for sp calls.INTERNAL: Used for stored procedure defs.INTERNAL: Used for pessimistic locking in DB2.org.eclipse.persistence.internal.helper.DatabaseTable
getTempTableForTable
(org.eclipse.persistence.internal.helper.DatabaseTable table) INTERNAL: DB2 temp table syntax.INTERNAL: This method returns the query to select the timestamp from the server for DB2.void
initializeConnectionData
(Connection connection) INTERNAL: Allow initialization from the connection.protected void
INTERNAL: Initialize any platform-specific operatorsboolean
INTERNAL: DB2 added SEQUENCE support as of (I believe) v8.boolean
isDB2()
boolean
INTERNAL DB2 has some issues with using parameters on certain functions and relations.boolean
INTERNAL: DB2 does not allow NULL in select clause.protected ExpressionOperator
Disable binding support.protected ExpressionOperator
DB2 does not support untyped parameter binding forprotected ExpressionOperator
max()
Disable binding support.INTERNAL: Builds a table of maximum numeric values keyed on java class.protected ExpressionOperator
min()
Disable binding support.INTERNAL: Builds a table of minimum numeric values keyed on java class.protected ExpressionOperator
DB2 requires that at least one argument be a known typevoid
printFieldIdentityClause
(Writer writer) INTERNAL: Append the receiver's field 'identity' constraint clause to a writer.protected void
printFieldTypeSize
(Writer writer, FieldDefinition field, org.eclipse.persistence.internal.databaseaccess.FieldTypeDefinition ftd) void
printSQLSelectStatement
(org.eclipse.persistence.internal.databaseaccess.DatabaseCall call, org.eclipse.persistence.internal.expressions.ExpressionSQLPrinter printer, org.eclipse.persistence.internal.expressions.SQLSelectStatement statement) INTERNAL: Print the SQL representation of the statement on a stream, storing the fields in the DatabaseCall.protected ExpressionOperator
DB2 does not support untyped parameter binding forboolean
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 bindingboolean
shouldIgnoreException
(SQLException exception) INTERNAL: Allow for the platform to ignore exceptions.boolean
boolean
INTERNAL: This is required in the construction of the stored procedures with output parameters.boolean
INTERNAL: JDBC defines and outer join syntax, many drivers do not support this.boolean
INTERNAL: DB2 supports temp tables.boolean
INTERNAL: Indicates whether the platform supports identity.boolean
INTERNAL: DB2 does not seem to allow FOR UPDATE on queries with multiple tables.boolean
DB2 disables single parameter usage in ORDER BY clause.boolean
INTERNAL: DB2 added SEQUENCE support as of (I believe) v8.protected ExpressionOperator
trim2()
DB2 does not support untyped parameter binding forvoid
writeParameterMarker
(Writer writer, org.eclipse.persistence.internal.expressions.ParameterExpression parameter, org.eclipse.persistence.internal.sessions.AbstractRecord record, org.eclipse.persistence.internal.databaseaccess.DatabaseCall call) INTERNAL: DB2 requires casting on certain operations, such as the CONCAT function, and parameterized queries of the form, ":param = :param".Methods inherited from class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
addBatch, addStructConverter, allowsSizeInProcedureArguments, appendBoolean, appendLiteralToCall, appendLiteralToCallWithBinding, appendNumber, appendParameter, appendParameterInternal, appendString, autoCommit, beginTransaction, buildBatchCriteria, buildBatchCriteriaForComplexId, buildCallWithReturning, buildClassTypes, buildCreateIndex, buildCreateIndex, buildDropIndex, buildDropIndex, buildProcedureCallString, buildSequenceObjectAlterIncrementWriter, buildSequenceObjectCreationWriter, buildSequenceObjectDeletionWriter, canBatchWriteWithOptimisticLocking, canBuildCallWithReturning, checkTableExists, commitTransaction, computeMaxRowsForSQL, convertToDatabaseType, copyInto, createArray, createArray, createPlatformDefaultSequence, createStruct, createStruct, createStruct, executeBatch, executeStoredProcedure, freeTemporaryObject, getAssignmentString, getBatchBeginString, getBatchDelimiterString, getBatchEndString, getBatchRowCountAssignString, getBatchRowCountDeclareString, getBatchRowCountReturnString, getBatchWritingMechanism, getCastSizeForVarcharParameter, getClassTypes, getConnection, getConnectionUserName, getConstraintDeletionString, getCreateDatabaseSchemaString, getCreateViewString, getCreationInOutputProcedureToken, getCreationOutputProcedureToken, getCursorCode, getCustomModifyValueForCall, getDefaultSequenceTableName, getDriverSupportsNVarChar, getDropCascadeString, getDropDatabaseSchemaString, getFieldTypeDefinition, getFieldTypes, getFunctionCallHeader, getIndexNamePrefix, getInOutputProcedureToken, getInputProcedureToken, getJDBCOuterJoinString, getJDBCType, getJDBCType, getJDBCTypeForSetNull, getJdbcTypeName, getMaxBatchWritingSize, getMaxIndexNameSize, getObjectFromResultSet, getOutputProcedureToken, getParameterValueFromDatabaseCall, getParameterValueFromDatabaseCall, getPartitioningCallback, getPingSQL, getProcedureArgument, getProcedureArgumentString, getProcedureCallTail, getProcedureOptionList, getQualifiedName, getQualifiedSequenceTableName, getRefValue, getRefValue, getSelectForUpdateNoWaitString, getSelectForUpdateOfString, getSelectForUpdateWaitString, getSequenceCounterFieldName, getSequenceNameFieldName, getSequencePreallocationSize, getSequenceTableName, getStatementCacheSize, getStoredProcedureParameterPrefix, getStoredProcedureTerminationToken, getStringBindingSize, getStructConverters, getTableCreationSuffix, getTableExistsQuery, getTransactionIsolation, getTypeConverters, getUniqueConstraintDeletionString, getUseNationalCharacterVaryingTypeForString, getVPDClearIdentifierQuery, getVPDCreationFunctionString, getVPDCreationPolicyString, getVPDDeletionString, getVPDSetIdentifierQuery, hasPartitioningCallback, initialize, isCastRequired, isForUpdateCompatibleWithDistinct, isInformixOuterJoin, isJDBCExecuteCompliant, isLobCompatibleWithDistinct, isLockTimeoutException, isOutputAllowWithResultSet, isRowCountOutputParameterRequired, isXDBDocument, minimumTimeIncrement, prepareBatchStatement, printFieldNotNullClause, printFieldNullClause, printFieldTypeSize, printFieldUnique, printFieldUnique, printStoredFunctionReturnKeyWord, printValuelist, printValuelist, registerOutputParameter, registerOutputParameter, registerOutputParameter, registerOutputParameter, requiresNamedPrimaryKeyConstraints, requiresProcedureBrackets, requiresProcedureCallBrackets, requiresProcedureCallOuputToken, requiresTableInIndexDropDDL, requiresTypeNameToRegisterOutputParameter, requiresUniqueConstraintCreationOnTableCreate, retrieveFirstPrimaryKeyOrOne, rollbackTransaction, setBatchWritingMechanism, setCastSizeForVarcharParameter, setClassTypes, setCursorCode, setDriverName, setDriverSupportsNVarChar, setFieldTypes, setIsCastRequired, setMaxBatchWritingSize, setNullFromDatabaseField, setNullFromDatabaseField, setParameterValueInDatabaseCall, setParameterValueInDatabaseCall, setPartitioningCallback, setPingSQL, setPrintInnerJoinInWhereClause, setPrintOuterJoinInWhereClause, setSequenceCounterFieldName, setSequenceNameFieldName, setSequenceTableName, setShouldBindAllParameters, setShouldBindLiterals, setShouldBindPartialParameters, setShouldCacheAllStatements, setShouldCreateIndicesOnForeignKeys, setShouldForceBindAllParameters, setShouldForceFieldNamesToUpperCase, setShouldIgnoreCaseOnFieldComparisons, setShouldOptimizeDataConversion, setShouldTrimStrings, setShouldUseRownumFiltering, setStatementCacheSize, setStoredProcedureTerminationToken, setStringBindingSize, setSupportsAutoCommit, setTableCreationSuffix, setTransactionIsolation, setUseJDBCStoredProcedureSyntax, setUseNationalCharacterVaryingTypeForString, setUsesBatchWriting, setUsesByteArrayBinding, setUsesJDBCBatchWriting, setUsesNativeBatchWriting, setUsesNativeSQL, setUsesStreamsForBinding, setUsesStringBinding, shouldAlwaysUseTempStorageForModifyAll, shouldBindAllParameters, shouldBindLiterals, shouldCacheAllStatements, shouldCreateIndicesForPrimaryKeys, shouldCreateIndicesOnForeignKeys, shouldCreateIndicesOnUniqueKeys, shouldForceBindAllParameters, shouldForceFieldNamesToUpperCase, shouldIgnoreCaseOnFieldComparisons, shouldOptimizeDataConversion, shouldPrintAliasForUpdate, shouldPrintConstraintNameAfter, shouldPrintFieldIdentityClause, shouldPrintInnerJoinInWhereClause, shouldPrintInOutputTokenBeforeType, shouldPrintInputTokenAtStart, shouldPrintLockingClauseAfterWhereClause, shouldPrintOuterJoinInWhereClause, shouldPrintOutputTokenBeforeType, shouldPrintStoredProcedureArgumentNameInCall, shouldPrintStoredProcedureVariablesAfterBeginString, shouldTempTableSpecifyPrimaryKeys, shouldTrimStrings, shouldUseCustomModifyForCall, shouldUseGetSetNString, shouldUseRownumFiltering, supportsANSIInnerJoinSyntax, supportsAutoCommit, supportsAutoConversionToNumericForArithmeticOperations, supportsConnectionUserName, supportsCountDistinctWithMultipleFields, supportsDeleteOnCascade, supportsForeignKeyConstraints, supportsIndexes, supportsIndividualTableLocking, supportsLocalTempTables, supportsNestingOuterJoins, supportsOuterJoinsWithBrackets, supportsPrimaryKeyConstraint, supportsStoredFunctions, supportsTempTables, supportsUniqueColumns, supportsUniqueKeyConstraints, supportsVPD, supportsWaitForUpdate, usesBatchWriting, usesByteArrayBinding, usesJDBCBatchWriting, usesNativeBatchWriting, usesNativeSQL, usesSequenceTable, usesStreamsForBinding, usesStringBinding, wasFailureCommunicationBased, writeAddColumnClause, writeAutoAssignmentSetClause, writeAutoJoinWhereClause, writeCleanUpTempTableSql, writeCreateTempTableSql, writeDeleteFromTargetTableUsingTempTableSql, writeFields, writeFieldsAutoClause, writeFieldsList, writeInsertIntoTableSql, writeJoinWhereClause, writeLOB, writeTableCreationSuffix, writeUpdateOriginalFromTempTableSql
Methods inherited from class org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
addOperator, addSequence, addSequence, buildNativeCall, buildSelectQueryForIdentity, buildSelectQueryForSequenceObject, clone, convertObject, createConnectionCustomizer, createExpressionFor, getConversionManager, getDataTypesConvertedFrom, getDataTypesConvertedTo, getDefaultNativeSequenceToTable, getDefaultSeqenceAtNextValue, getDefaultSequence, getDefaultSequenceToWrite, getEndDelimiter, getINClauseLimit, getOperator, getPlatformOperators, getSelectSequenceQuery, getSequence, getSequences, getSequencesToWrite, getStartDelimiter, getTableQualifier, getTimestampFromServer, getUpdateSequenceQuery, hasDefaultSequence, initializeDefaultQueries, initIdentitySequences, isAccess, isAttunity, isCloudscape, isDB2Z, isDBase, isDerby, isFirebird, isH2, isHANA, isHSQL, isInformix, isMaxDB, isMySQL, isODBC, isOracle, isOracle12, isOracle9, isPervasive, isPointBase, isPostgreSQL, isSQLAnywhere, isSQLServer, isSybase, isSymfoware, isTimesTen, isTimesTen7, removeAllSequences, removeIdentitySequences, removeSequence, sequencesAfterCloneCleanup, setConversionManager, setDefaultNativeSequenceToTable, setDefaultSeqenceAtNextValue, setDefaultSequence, setEndDelimiter, setSelectSequenceNumberQuery, setSequencePreallocationSize, setSequences, setStartDelimiter, setSupportsReturnGeneratedKeys, setTableQualifier, setTimestampQuery, setUpdateSequenceQuery, shouldNativeSequenceUseTransaction, shouldPrepare, shouldSelectDistinctIncludeOrderBy, shouldSelectIncludeOrderBy, supportsNativeSequenceNumbers, supportsReturnGeneratedKeys, toString, usesPlatformDefaultSequence
-
Constructor Details
-
DB2Platform
public DB2Platform()
-
-
Method Details
-
initializeConnectionData
Description copied from class:org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
INTERNAL: Allow initialization from the connection.- Overrides:
initializeConnectionData
in classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
- Throws:
SQLException
-
appendByteArray
INTERNAL: Append a byte[] in native DB@ format BLOB(hexString) if usesNativeSQL(), otherwise use ODBC format from DatabasePLatform.- Overrides:
appendByteArray
in classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
- Throws:
IOException
-
appendDate
INTERNAL: Appends the Date in native format if usesNativeSQL() otherwise use ODBC format from DatabasePlatform. Native format: 'mm/dd/yyyy'- Overrides:
appendDate
in classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
- Throws:
IOException
-
appendDB2Date
INTERNAL: Write a timestamp in DB2 specific format (mm/dd/yyyy).- Throws:
IOException
-
appendDB2Timestamp
INTERNAL: Write a timestamp in DB2 specific format (yyyy-mm-dd-hh.mm.ss.ffffff).- Throws:
IOException
-
appendDB2Calendar
Write a timestamp in DB2 specific format (yyyy-mm-dd-hh.mm.ss.ffffff).- Throws:
IOException
-
appendTime
INTERNAL: Append the Time in Native format if usesNativeSQL() otherwise use ODBC format from DAtabasePlatform. Native Format: 'hh:mm:ss'- Overrides:
appendTime
in classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
- Throws:
IOException
-
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'- Overrides:
appendTimestamp
in classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
- Throws:
IOException
-
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'- Overrides:
appendCalendar
in classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
- Throws:
IOException
-
buildFieldTypes
Description copied from class:org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
Return the mapping of class types to database types for the schema framework.- Overrides:
buildFieldTypes
in classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
getMaxFieldNameSize
public int getMaxFieldNameSize()INTERNAL: returns the maximum number of characters that can be used in a field name on this platform.- Overrides:
getMaxFieldNameSize
in classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
getMaxForeignKeyNameSize
public int getMaxForeignKeyNameSize()INTERNAL: returns the maximum number of characters that can be used in a foreign key name on this platform.- Overrides:
getMaxForeignKeyNameSize
in classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
getMaxUniqueKeyNameSize
public int getMaxUniqueKeyNameSize()INTERNAL: returns the maximum number of characters that can be used in a unique key name on this platform.- Overrides:
getMaxUniqueKeyNameSize
in classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
getNativeTableInfo
public Vector getNativeTableInfo(String table, String creator, org.eclipse.persistence.internal.sessions.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. -
getProcedureCallHeader
INTERNAL: Used for sp calls.- Overrides:
getProcedureCallHeader
in classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
getSelectForUpdateString
INTERNAL: Used for pessimistic locking in DB2. Without the "WITH RS" the lock is not held.- Overrides:
getSelectForUpdateString
in classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
getProcedureEndString
INTERNAL: Used for stored procedure defs.- Overrides:
getProcedureEndString
in classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
getProcedureBeginString
Used for stored procedure defs.- Overrides:
getProcedureBeginString
in classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
getProcedureAsString
INTERNAL: Used for stored procedure defs.- Overrides:
getProcedureAsString
in classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
getProcedureArgument
public String getProcedureArgument(String name, Object parameter, org.eclipse.persistence.internal.databaseaccess.DatasourceCall.ParameterType parameterType, StoredProcedureCall call, org.eclipse.persistence.internal.sessions.AbstractSession session) Obtain the platform specific argument string- Overrides:
getProcedureArgument
in classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
shouldPrintOutputTokenAtStart
public boolean shouldPrintOutputTokenAtStart()INTERNAL: This is required in the construction of the stored procedures with output parameters.- Overrides:
shouldPrintOutputTokenAtStart
in classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
shouldBindPartialParameters
public boolean 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- Overrides:
shouldBindPartialParameters
in classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
getTimestampQuery
INTERNAL: This method returns the query to select the timestamp from the server for DB2.- Specified by:
getTimestampQuery
in interfaceorg.eclipse.persistence.internal.databaseaccess.Platform
- Overrides:
getTimestampQuery
in classorg.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
-
initializePlatformOperators
protected void initializePlatformOperators()INTERNAL: Initialize any platform-specific operators- Overrides:
initializePlatformOperators
in classorg.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
-
disableAllBindingExpression
Create an ExpressionOperator that disables all parameter binding -
disableAtLeast1BindingExpression
Create an ExpressionOperator that requires at least 1 typed argument -
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.
-
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.
-
concatOperator
INTERNAL: The concat operator is of the form .... VARCHAR (|| ) -
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.
-
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.
-
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.
-
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.
-
caseOperator
DB2 does not allow untyped parameter binding for the THEN & ELSE 'result-expressions' of CASE expressionsWith 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.
-
caseConditionOperator
DB2 does not allow untyped parameter binding for the THEN & ELSE 'result-expressions' of CASE expressionsWith 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.
-
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.
-
nullifOperator
DB2 requires that at least one argument be a known typeWith 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.
-
coalesceOperator
DB2 requires that at least one argument be a known typeWith 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.
-
trim2
DB2 does not support untyped parameter binding forWith 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
-
ltrim2Operator
DB2 does not support untyped parameter binding forWith 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
-
rtrim2Operator
DB2 does not support untyped parameter binding forWith 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
-
isDB2
public boolean isDB2()- Specified by:
isDB2
in interfaceorg.eclipse.persistence.internal.databaseaccess.Platform
- Overrides:
isDB2
in classorg.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
-
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
- Overrides:
maximumNumericValues
in classorg.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
- Overrides:
minimumNumericValues
in classorg.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.- Overrides:
shouldIgnoreException
in classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
shouldUseJDBCOuterJoinSyntax
public boolean shouldUseJDBCOuterJoinSyntax()INTERNAL: JDBC defines and outer join syntax, many drivers do not support this. So we normally avoid it.- Overrides:
shouldUseJDBCOuterJoinSyntax
in classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
buildSelectQueryForIdentity
INTERNAL: Build the identity query for native sequencing.- Overrides:
buildSelectQueryForIdentity
in classorg.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
-
printFieldIdentityClause
INTERNAL: Append the receiver's field 'identity' constraint clause to a writer. Used by table creation with sequencing.- Overrides:
printFieldIdentityClause
in classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
- Throws:
ValidationException
-
printFieldTypeSize
protected void printFieldTypeSize(Writer writer, FieldDefinition field, org.eclipse.persistence.internal.databaseaccess.FieldTypeDefinition ftd) throws IOException - Overrides:
printFieldTypeSize
in classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
- Throws:
IOException
-
supportsIdentity
public boolean supportsIdentity()INTERNAL: Indicates whether the platform supports identity. DB2 does through AS IDENTITY field types. This is used by sequencing.- Overrides:
supportsIdentity
in classorg.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
-
supportsGlobalTempTables
public boolean supportsGlobalTempTables()INTERNAL: DB2 supports temp tables. This is used by UpdateAllQuerys.- Overrides:
supportsGlobalTempTables
in classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
getCreateTempTableSqlPrefix
INTERNAL: DB2 temp table syntax. This is used by UpdateAllQuerys.- Overrides:
getCreateTempTableSqlPrefix
in classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
getTempTableForTable
public org.eclipse.persistence.internal.helper.DatabaseTable getTempTableForTable(org.eclipse.persistence.internal.helper.DatabaseTable table) INTERNAL: DB2 temp table syntax. This is used by UpdateAllQuerys.- Overrides:
getTempTableForTable
in classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
- Parameters:
table
- is original table for which temp table is created.- Returns:
- temporary table
-
getCreateTempTableSqlSuffix
INTERNAL: DB2 temp table syntax. This is used by UpdateAllQuerys.- Overrides:
getCreateTempTableSqlSuffix
in classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
getCreateTempTableSqlBodyForTable
protected String getCreateTempTableSqlBodyForTable(org.eclipse.persistence.internal.helper.DatabaseTable table) INTERNAL: DB2 allows LIKE to be used to create temp tables, which avoids having to know the types. This is used by UpdateAllQuerys.- Overrides:
getCreateTempTableSqlBodyForTable
in classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
- Parameters:
table
- is original table for which temp table is created.- Returns:
- String
-
getNoWaitString
INTERNAL: DB2 does not support NOWAIT.- Overrides:
getNoWaitString
in classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
dontBindUpdateAllQueryUsingTempTables
public boolean dontBindUpdateAllQueryUsingTempTables()INTERNAL: DB2 has issues with binding with temp table queries. This is used by UpdateAllQuerys.- Overrides:
dontBindUpdateAllQueryUsingTempTables
in classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
isNullAllowedInSelectClause
public boolean isNullAllowedInSelectClause()INTERNAL: DB2 does not allow NULL in select clause. This is used by UpdateAllQuerys.- Overrides:
isNullAllowedInSelectClause
in classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
isDynamicSQLRequiredForFunctions
public boolean 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.- Overrides:
isDynamicSQLRequiredForFunctions
in classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
allowBindingForSelectClause
public boolean allowBindingForSelectClause()INTERNAL: DB2 does not allow stand alone, untyped parameter markers in select clause.- Overrides:
allowBindingForSelectClause
in classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
- See Also:
-
ConstantExpression.writeFields(ExpressionSQLPrinter, List, SQLSelectStatement)
ParameterExpression.writeFields(ExpressionSQLPrinter, List, SQLSelectStatement)
-
writeParameterMarker
public void writeParameterMarker(Writer writer, org.eclipse.persistence.internal.expressions.ParameterExpression parameter, org.eclipse.persistence.internal.sessions.AbstractRecord record, org.eclipse.persistence.internal.databaseaccess.DatabaseCall call) throws IOException 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.- Overrides:
writeParameterMarker
in classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
- Throws:
IOException
-
supportsLockingQueriesWithMultipleTables
public boolean 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.- Overrides:
supportsLockingQueriesWithMultipleTables
in classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
buildSelectQueryForSequenceObject
INTERNAL: DB2 added SEQUENCE support as of (I believe) v8.- Overrides:
buildSelectQueryForSequenceObject
in classorg.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
-
supportsSequenceObjects
public boolean supportsSequenceObjects()INTERNAL: DB2 added SEQUENCE support as of (I believe) v8.- Overrides:
supportsSequenceObjects
in classorg.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
-
supportsOrderByParameters
public boolean 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.
- Overrides:
supportsOrderByParameters
in classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
isAlterSequenceObjectSupported
public boolean isAlterSequenceObjectSupported()INTERNAL: DB2 added SEQUENCE support as of (I believe) v8.- Overrides:
isAlterSequenceObjectSupported
in classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
shouldPrintForUpdateClause
public boolean shouldPrintForUpdateClause()- Overrides:
shouldPrintForUpdateClause
in classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
printSQLSelectStatement
public void printSQLSelectStatement(org.eclipse.persistence.internal.databaseaccess.DatabaseCall call, org.eclipse.persistence.internal.expressions.ExpressionSQLPrinter printer, org.eclipse.persistence.internal.expressions.SQLSelectStatement statement) 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.- Overrides:
printSQLSelectStatement
in classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-