Class DatabaseLogin

java.lang.Object
org.eclipse.persistence.sessions.DatasourceLogin
org.eclipse.persistence.sessions.DatabaseLogin
All Implemented Interfaces:
Serializable, Cloneable, CoreLogin<org.eclipse.persistence.internal.databaseaccess.Platform>, Login

public class DatabaseLogin extends DatasourceLogin

Purpose: Hold the configuration information necessary to connect to a JDBC driver.

Description: A DatabaseLogin is used by an EclipseLink database session to connect to a JDBC server.

Responsibilities:

  • Hold the driver class name and URL header
  • Hold the database URL
  • Hold any driver-specific database connection properties (e.g. "user", "database")
  • Build the JDBC driver connect string
  • Hold the database platform (e.g. Oracle, DB2)
  • Hold the message logging stream
  • Hold other assorted configuration settings
See Also:
  • Field Details

    • TRANSACTION_NONE

      public static final int TRANSACTION_NONE
      Transactions are not supported.
      See Also:
    • TRANSACTION_READ_UNCOMMITTED

      public static final int TRANSACTION_READ_UNCOMMITTED
      Dirty reads, non-repeatable reads and phantom reads can occur.
      See Also:
    • TRANSACTION_READ_COMMITTED

      public static final int TRANSACTION_READ_COMMITTED
      Dirty reads are prevented; non-repeatable reads and phantom reads can occur.
      See Also:
    • TRANSACTION_REPEATABLE_READ

      public static final int TRANSACTION_REPEATABLE_READ
      Dirty reads and non-repeatable reads are prevented; phantom reads can occur.
      See Also:
    • TRANSACTION_SERIALIZABLE

      public static final int TRANSACTION_SERIALIZABLE
      Dirty reads, non-repeatable reads and phantom reads are prevented.
      See Also:
    • queryRetryAttemptCount

      protected int queryRetryAttemptCount
      Stores the value for the number of time EclipseLink will attempt to reconnect the connection on a comm failure in the case EclipseLink is attempting to retry a query. EclipseLink will retry a read query outside of a transaction if EclipseLink can determine that a communication error occurred with the database.
    • delayBetweenConnectionAttempts

      protected int delayBetweenConnectionAttempts
      Stores the number of milliseconds that EclipseLink will wait between attempts to reconnect a DatabaseConnection in the case EclipseLink is attempting to retry a query. EclipseLink will retry a read query outside of a transaction if EclipseLink can determine that a communication error occurred with the database.
    • connectionHealthValidatedOnError

      protected Boolean connectionHealthValidatedOnError
      On an SQL Exception EclipseLink will ping the database to determine if the connection used can continue to be used for queries. This should have no impact on applications unless the user is using pessimistic locking queries with 'no wait' or are using a query timeout feature. If that is the case and the application is experiencing a performance impact from the health check then this feature can be turned off. Turning this feature off will prevent EclipseLink from being able to retry queries in the case of database failure. By default (null) connection health is validate if the query does not have a timeout, and there is a ping string. Setting to true or false overrides this.
  • Constructor Details

    • DatabaseLogin

      public DatabaseLogin()
      PUBLIC: Create a new login.
    • DatabaseLogin

      public DatabaseLogin(DatabasePlatform databasePlatform)
      ADVANCED: Create a new login for the given platform.
  • Method Details

    • usePlatform

      public void usePlatform(DatabasePlatform platform)
      ADVANCED: Set the database platform to be custom platform.
    • addStructConverter

      public void addStructConverter(StructConverter converter)
      ADVANCED: Add a StructConverter
      Parameters:
      converter -
      See Also:
    • bindAllParameters

      public void bindAllParameters()
      PUBLIC: Bind all arguments to any SQL statement.
    • buildAccessor

      public org.eclipse.persistence.internal.databaseaccess.Accessor buildAccessor()
      INTERNAL: Build and return an appropriate Accessor. The default is a DatabaseAccessor.
    • cacheAllStatements

      public void cacheAllStatements()
      PUBLIC: Cache all prepared statements, this requires full parameter binding as well.
      See Also:
    • dontBindAllParameters

      public void dontBindAllParameters()
      PUBLIC: Do not bind all arguments to any SQL statement.
    • dontCacheAllStatements

      public void dontCacheAllStatements()
      PUBLIC: Do not cache all prepared statements.
    • dontOptimizeDataConversion

      public void dontOptimizeDataConversion()
      PUBLIC: Disable driver level data conversion optimization. This can be disabled as some drivers perform data conversion themselves incorrectly.
    • dontUseBatchWriting

      public void dontUseBatchWriting()
      PUBLIC: EclipseLink can be configured to use batch writing. This facility allows multiple write operations to be submitted to a database for processing at once. Submitting multiple updates together, instead of individually, can greatly improve performance in some situations.
    • dontUseByteArrayBinding

      public void dontUseByteArrayBinding()
      PUBLIC: EclipseLink can be configured to use parameter binding for large binary data. By default EclipseLink will print this data as hex through the JDBC binary escape clause. Both binding and printing have various limits on all databases (e.g. 5k - 32k).
    • dontUseJDBCBatchWriting

      public void dontUseJDBCBatchWriting()
      PUBLIC: Indicate to EclipseLink that the JDBC driver does not support batch writing. This will revert to the default behavior which is to delegate to EclipseLink's internal batch writing.
      See Also:
    • dontUseNativeSQL

      public void dontUseNativeSQL()
      PUBLIC: EclipseLink can be configured to use database-specific SQL grammar, as opposed to the JDBC standard grammar. This is because, unfortunately, some drivers to not support the full JDBC standard. By default EclipseLink uses the JDBC SQL grammar.
    • dontUseStreamsForBinding

      public void dontUseStreamsForBinding()
      PUBLIC: EclipseLink can be configured to use streams to store large binary data.
    • dontUseStringBinding

      public void dontUseStringBinding()
      PUBLIC: Do not bind strings of any size.
    • shouldCreateIndicesOnForeignKeys

      public boolean shouldCreateIndicesOnForeignKeys()
      PUBLIC: Used for table creation. Most databases do not create an index automatically for foreign key columns. Normally it is recommended to index foreign key columns. This allows for foreign key indexes to be configured, by default foreign keys are not indexed.
      Returns:
      whether an index should be created explicitly for foreign key constraints
    • setShouldCreateIndicesOnForeignKeys

      public void setShouldCreateIndicesOnForeignKeys(boolean shouldCreateIndicesOnForeignKeys)
      PUBLIC: Used for table creation. Most databases do not create an index automatically for foreign key columns. Normally it is recommended to index foreign key columns. This allows for foreign key indexes to be configured, by default foreign keys are not indexed.
    • driverIs

      protected boolean driverIs(String driverName)
      INTERNAL: Return whether the specified driver is being used.
    • getConnectionString

      public String getConnectionString() throws ValidationException
      PUBLIC: Return the JDBC connection string. This is a combination of the driver-specific URL header and the database URL.
      Throws:
      ValidationException
    • getCursorCode

      public int getCursorCode()
      ADVANCED: Return the code for preparing cursored output parameters in a stored procedure
    • getDatabaseName

      public String getDatabaseName()
      PUBLIC: The database name is required when connecting to databases that support multiple databases within a single server instance (e.g. Sybase, SQL Server). This is ONLY used when connecting through ODBC type JDBC drivers. This is NEVER used with Oracle.
    • getDatabaseURL

      public String getDatabaseURL()
      PUBLIC: The database URL is the JDBC URL for the database server. The driver header is not be included in this URL (e.g. "dbase files"; not "jdbc:odbc:dbase files").
    • getDataSourceName

      public String getDataSourceName() throws ValidationException
      PUBLIC: The data source name is required if connecting through ODBC (JDBC-ODBC, etc.). This is the ODBC name given in the ODBC Data Source Administrator. This is just the database part of the URL.
      Throws:
      ValidationException
    • getDatasourcePlatform

      public org.eclipse.persistence.internal.databaseaccess.Platform getDatasourcePlatform()
      PUBLIC: Return the datasource platform specific information. This allows EclipseLink to configure certain advanced features for the datasource desired.
      Specified by:
      getDatasourcePlatform in interface CoreLogin<org.eclipse.persistence.internal.databaseaccess.Platform>
      Specified by:
      getDatasourcePlatform in interface Login
      Overrides:
      getDatasourcePlatform in class DatasourceLogin
    • getDefaultConnector

      protected DefaultConnector getDefaultConnector() throws ValidationException
      INTERNAL: Return the connector that will instantiate the java.sql.Connection.
      Throws:
      ValidationException
    • getDriverClassName

      public String getDriverClassName()
      PUBLIC: The driver class is the name of the Java class for the JDBC driver being used (e.g. "sun.jdbc.odbc.JdbcOdbcDriver").
    • getDriverURLHeader

      public String getDriverURLHeader()
      PUBLIC: The driver URL header is the string predetermined by the JDBC driver to be part of the URL connection string, (e.g. "jdbc:odbc:"). This is required to connect to the database.
    • getMaxBatchWritingSize

      public int getMaxBatchWritingSize()
      PUBLIC: Allow for the max batch writing size to be set. This allows for the batch size to be limited as most database have strict limits. If returns 0 then default size value is used. The size is in characters, the default is 32000 but the real value depends on the database configuration.
    • getPingSQL

      public String getPingSQL()
      PUBLIC: EclipseLink will attempt to test a connection if it encounters an exception on the connection when executing SQL. This attribute represents the SQL query that will be executed by EclipseLink. By default EclipseLink uses a query that should be correct for the specified platform but users may need or want to override that query.
    • getQueryRetryAttemptCount

      public int getQueryRetryAttemptCount()
      PUBLIC: Return the number of attempts EclipseLink should make to re-connect to a database and re-execute a query after a query has failed because of a communication issue. EclipseLink will only attempt to reconnect when EclipseLink can determine that a communication failure occurred on a read query executed outside of a transaction. By default EclipseLink will attempt to retry the query 3 times, by setting this value to 0 EclipseLink will not retry queries.
    • getServerName

      public String getServerName()
      PUBLIC: The server name is the name of the database instance. This is ONLY required if using an ODBC JDBC driver and overriding the server name specified in the ODBC Data Source Administrator.
    • getShouldBindAllParameters

      public boolean getShouldBindAllParameters()
      PUBLIC: Used to help bean introspection.
    • getShouldCacheAllStatements

      public boolean getShouldCacheAllStatements()
      PUBLIC: Used to help bean introspection.
    • getShouldOptimizeDataConversion

      public boolean getShouldOptimizeDataConversion()
      PUBLIC: Used to help bean introspection.
    • getShouldTrimStrings

      public boolean getShouldTrimStrings()
      PUBLIC: Used to help bean introspection.
    • getStatementCacheSize

      public int getStatementCacheSize()
      PUBLIC: If prepared statement caching is used, return the cache size. The default is 50.
    • getStringBindingSize

      public int getStringBindingSize()
      PUBLIC: Used to help bean introspection.
    • getTableCreationSuffix

      public String getTableCreationSuffix()
      PUBLIC: Get the String used on all table creation statements generated from the DefaultTableGenerator with a session using this project (DDL generation). This value will be appended to CreationSuffix strings stored on the DatabaseTable or TableDefinition.
    • getTransactionIsolation

      public int getTransactionIsolation()
      PUBLIC: Return the transaction isolation setting for the connection. Return -1 if it has not been set.
    • getUsesBinding

      public boolean getUsesBinding()
      PUBLIC: Used to help bean introspection.
    • getUsesNativeSequencing

      public boolean getUsesNativeSequencing()
      PUBLIC: Used to help bean introspection.
    • getUsesNativeSQL

      public boolean getUsesNativeSQL()
      PUBLIC: Used to help bean introspection.
    • getUsesStreamsForBinding

      public boolean getUsesStreamsForBinding()
      PUBLIC: Used to help bean introspection.
    • getUsesStringBinding

      public boolean getUsesStringBinding()
      PUBLIC: Used to help bean introspection.
    • handleTransactionsManuallyForSybaseJConnect

      public void handleTransactionsManuallyForSybaseJConnect()
      PUBLIC: Force EclipseLink to manually begin transactions instead of using autoCommit. Although autoCommit should be used, and work, under JDBC, some drivers (e.g. Sybase JConnect) do not correctly map autoCommit to transactions, so stored procedures may not work correctly. This property should only be used as a workaround for the Sybase JConnect transaction problem.
    • isAnyOracleJDBCDriver

      public boolean isAnyOracleJDBCDriver()
      PUBLIC: Return whether an Oracle JDBC driver is being used.
    • isCloudscapeJDBCDriver

      public boolean isCloudscapeJDBCDriver()
      PUBLIC: Return whether a Cloudscape JDBC driver is being used.
    • isDB2JDBCDriver

      public boolean isDB2JDBCDriver()
      PUBLIC: Return whether an IBM DB2 native client JDBC driver is being used.
    • isIntersolvSequeLinkDriver

      public boolean isIntersolvSequeLinkDriver()
      PUBLIC: Return whether an Intersolv SeqeLink JDBC driver is being used.
    • isJConnectDriver

      public boolean isJConnectDriver()
      PUBLIC: Return whether a Sybase JConnect JDBC driver is being used.
    • isJDBCConnectDriver

      public boolean isJDBCConnectDriver()
      PUBLIC: Return whether a Borland JDBCConnect JDBC driver is being used.
    • isJDBCConnectRemoteDriver

      public boolean isJDBCConnectRemoteDriver()
      PUBLIC: Return whether a Borland JDBCConnect JDBC driver is being used.
    • isJDBCODBCBridge

      public boolean isJDBCODBCBridge()
      PUBLIC: Return whether a Sun/Merant JDBC-ODBC bridge driver is being used.
    • isOracle7JDBCDriver

      public boolean isOracle7JDBCDriver()
      PUBLIC: Return whether an Oracle native 7.x OCI JDBC driver is being used.
    • isOracleJDBCDriver

      public boolean isOracleJDBCDriver()
      PUBLIC: Return whether an Oracle 8.x native OCI JDBC driver is being used.
    • isOracleServerJDBCDriver

      public boolean isOracleServerJDBCDriver()
      PUBLIC: Return whether an Oracle thin JDBC driver is being used.
    • isOracleThinJDBCDriver

      public boolean isOracleThinJDBCDriver()
      PUBLIC: Return whether an Oracle thin JDBC driver is being used.
    • isWebLogicOracleOCIDriver

      public boolean isWebLogicOracleOCIDriver()
      PUBLIC: Return whether a WebLogic Oracle OCI JDBC driver is being used.
    • isWebLogicSQLServerDBLibDriver

      public boolean isWebLogicSQLServerDBLibDriver()
      PUBLIC: Return whether a WebLogic SQL Server dblib JDBC driver is being used.
    • isWebLogicSQLServerDriver

      public boolean isWebLogicSQLServerDriver()
      PUBLIC: Return whether a WebLogic SQL Server JDBC driver is being used.
    • isWebLogicSybaseDBLibDriver

      public boolean isWebLogicSybaseDBLibDriver()
      PUBLIC: Return whether a WebLogic Sybase dblib JDBC driver is being used.
    • isWebLogicThinClientDriver

      public boolean isWebLogicThinClientDriver()
      PUBLIC: Return whether a WebLogic thin client JDBC driver is being used.
    • isWebLogicThinDriver

      public boolean isWebLogicThinDriver()
      PUBLIC: Return whether a WebLogic thin JDBC driver is being used.
    • optimizeDataConversion

      public void optimizeDataConversion()
      PUBLIC: Enable driver level data conversion optimization. This can be disabled as some drivers perform data conversion themselves incorrectly.
    • oracleDriverIs

      protected boolean oracleDriverIs(String urlPrefix)
      INTERNAL: Return whether the specified Oracle JDBC driver is being used.
    • setConnectionString

      public void setConnectionString(String url) throws ValidationException
      PUBLIC: Set the JDBC connection string. This is the full JDBC connect URL. Normally EclipseLink breaks this into two parts to allow for the driver header to be automatically set, however sometimes it is easier just to set the entire URL at once.
      Throws:
      ValidationException
    • setURL

      public void setURL(String url)
      PUBLIC: Set the JDBC URL. This is the full JDBC connect URL. Normally EclipseLink breaks this into two parts to allow for the driver header to be automatically set, however sometimes it is easier just to set the entire URL at once.
    • getURL

      public String getURL()
      PUBLIC: Return the JDBC URL. This is the full JDBC connect URL. Normally EclipseLink breaks this into two parts to allow for the driver header to be automatically set, however sometimes it is easier just to set the entire URL at once.
    • setCursorCode

      public void setCursorCode(int cursorCode)
      ADVANCED: Set the code for preparing cursored output parameters in a stored procedure
    • setDatabaseName

      public void setDatabaseName(String databaseName)
      PUBLIC: The database name is required when connecting to databases that support multiple databases within a single server instance (e.g. Sybase, SQL Server). This is ONLY used when connecting through ODBC type JDBC drivers. This is NEVER used with Oracle.
    • setDatabaseURL

      public void setDatabaseURL(String databaseURL) throws ValidationException
      PUBLIC: The database URL is the JDBC URL for the database server. The driver header should not be included in this URL (e.g. "dbase files"; not "jdbc:odbc:dbase files").
      Throws:
      ValidationException
    • setODBCDataSourceName

      public void setODBCDataSourceName(String dataSourceName)
      PUBLIC: The data source name is required if connecting through ODBC (JDBC-ODBC, etc.). This is the ODBC name given in the ODBC Data Source Administrator. This is just the database part of the URL.
    • setPingSQL

      public void setPingSQL(String pingSQL)
      PUBLIC: EclipseLink will attempt to test a connection if it encounters an exception on the connection when executing SQL. This attribute represents the SQL query that will be executed by EclipseLink. By default EclipseLink uses a query that should be correct for the specified platform but users may need or want to override that query.
    • setQueryRetryAttemptCount

      public void setQueryRetryAttemptCount(int queryRetryAttemptCount)
      PUBLIC: Set the number of attempts EclipseLink should make to re-connect to a database and re-execute a query after a query has failed because of a communication issue. EclipseLink will only attempt to reconnect when EclipseLink can determine that a communication failure occurred on a read query executed outside of a transaction. By default EclipseLink will attempt to retry the query 3 times, by setting this value to 0 EclipseLink will not retry queries.
    • setDefaultNullValue

      public void setDefaultNullValue(Class type, Object value)
      PUBLIC: The default value to substitute for database NULLs can be configured on a per-class basis. Example: login.setDefaultNullValue(long.class, Long.valueOf(0))
      Overrides:
      setDefaultNullValue in class DatasourceLogin
    • setDriverClass

      public void setDriverClass(Class driverClass)
      PUBLIC: The driver class is the Java class for the JDBC driver to be used (e.g. sun.jdbc.odbc.JdbcOdbcDriver.class).
    • setDriverClassName

      public void setDriverClassName(String driverClassName) throws ValidationException
      PUBLIC: The name of the JDBC driver class to be used (e.g. "sun.jdbc.odbc.JdbcOdbcDriver").
      Throws:
      ValidationException
    • setDriverURLHeader

      public void setDriverURLHeader(String driverURLHeader) throws ValidationException
      PUBLIC: The driver URL header is the string predetermined by the JDBC driver to be part of the URL connection string, (e.g. "jdbc:odbc:"). This is required to connect to the database.
      Throws:
      ValidationException
    • setMaxBatchWritingSize

      public void setMaxBatchWritingSize(int maxBatchWritingSize)
      PUBLIC: Allow for the max batch writing size to be set. This allows for the batch size to be limited as most database have strict limits. If set to 0 then default value is used. The size is in characters, the default is 32000 but the real value depends on the database configuration.
    • setServerName

      public void setServerName(String name)
      PUBLIC: The server name is the name of the database instance. This is ONLY used when connecting through ODBC type JDBC drivers, and only if the data source does not specify it already.
    • setShouldBindAllParameters

      public void setShouldBindAllParameters(boolean shouldBindAllParameters)
      PUBLIC: Set whether to bind all arguments to any SQL statement.
    • setShouldCacheAllStatements

      public void setShouldCacheAllStatements(boolean shouldCacheAllStatements)
      PUBLIC: Set whether prepared statements should be cached.
    • setShouldForceFieldNamesToUpperCase

      public void setShouldForceFieldNamesToUpperCase(boolean shouldForceFieldNamesToUpperCase)
      ADVANCED: This setting can be used if the application expects upper case but the database does not return consistent case (e.g. different databases).
    • setShouldIgnoreCaseOnFieldComparisons

      public static void setShouldIgnoreCaseOnFieldComparisons(boolean shouldIgnoreCaseOnFieldComparisons)
      ADVANCED: Allow for case in field names to be ignored as some databases are not case sensitive. When using custom this can be an issue if the fields in the descriptor have a different case.
    • setShouldOptimizeDataConversion

      public void setShouldOptimizeDataConversion(boolean value)
      PUBLIC: Set whether driver level data conversion optimization is enabled. This can be disabled as some drivers perform data conversion themselves incorrectly.
    • setShouldTrimStrings

      public void setShouldTrimStrings(boolean shouldTrimStrings)
      PUBLIC: By default CHAR field values have trailing blanks trimmed, this can be configured.
    • setStatementCacheSize

      public void setStatementCacheSize(int size)
      PUBLIC: If prepared statement caching is used this configures the cache size. The default is 50.
    • setStringBindingSize

      public void setStringBindingSize(int stringBindingSize)
      PUBLIC: Used to help bean introspection.
    • setTableCreationSuffix

      public void setTableCreationSuffix(String tableCreationSuffix)
      PUBLIC: Get the String used on all table creation statements generated from the DefaultTableGenerator with a session using this project (DDL generation). This value will be appended to CreationSuffix strings stored on the DatabaseTable or TableDefinition. ie setTableCreationSuffix("engine=InnoDB");
    • setTableQualifier

      public void setTableQualifier(String qualifier)
      PUBLIC: Set the default qualifier for all tables. This can be the creator of the table or database name the table exists on. This is required by some databases such as Oracle and DB2.
      Overrides:
      setTableQualifier in class DatasourceLogin
    • setTransactionIsolation

      public void setTransactionIsolation(int isolationLevel)
      PUBLIC: Set the transaction isolation setting for the connection. This is an optional setting. The default isolation level set on the database will apply if it is not set here. Use one of the TRANSACTION_* constants for valid input values. Note: This setting will only take effect upon connection.
    • setUsesBatchWriting

      public void setUsesBatchWriting(boolean value)
      PUBLIC: EclipseLink can be configured to use batch writing. This facility allows multiple write operations to be submitted to a database for processing at once. Submitting multiple updates together, instead of individually, can greatly improve performance in some situations.
    • setUsesByteArrayBinding

      public void setUsesByteArrayBinding(boolean value)
      PUBLIC: EclipseLink can be configured to use parameter binding for large binary data. By default EclipseLink will print this data as hex through the JDBC binary excape clause. Both binding and printing have various limits on all databases (e.g. 5k - 32k).
    • setUsesJDBCBatchWriting

      public void setUsesJDBCBatchWriting(boolean usesJDBCBatchWriting)
      PUBLIC: Calling this method with an argument of true indicates to EclipseLink that the JDBC driver supports batch writing. EclipseLink's internal batch writing is disabled.

      Calling this method with an argument of false indicates to EclipseLink that the JDBC driver does not support batch writing. This will revert to the default behavior which is to delegate to EclipseLink's internal batch writing.

      Parameters:
      usesJDBCBatchWriting - boolean true delegates batch writing to the JDBC driver and false delegates batch writing to EclipseLink.

    • setUsesNativeSQL

      public void setUsesNativeSQL(boolean value)
      PUBLIC: EclipseLink can be configured to use database specific sql grammar not JDBC specific. This is because unfortunately some bridges to not support the full JDBC standard. By default EclipseLink uses the JDBC sql grammar.
    • setUsesStreamsForBinding

      public void setUsesStreamsForBinding(boolean value)
      PUBLIC: EclipseLink can be configured to use streams to store large binary data. This can improve the max size for reading/writing on some JDBC drivers.
    • setUsesStringBinding

      public void setUsesStringBinding(boolean usesStringBindingSize)
      PUBLIC: Used to help bean introspection.
    • getPartitioningCallback

      public DataPartitioningCallback getPartitioningCallback()
      PUBLIC: Return callback. Used to integrate with data partitioning in an external DataSource such as UCP.
    • setPartitioningCallback

      public void setPartitioningCallback(DataPartitioningCallback partitioningCallback)
      PUBLIC: Set callback. Used to integrate with data partitioning in an external DataSource such as UCP.
    • shouldBindAllParameters

      public boolean shouldBindAllParameters()
      PUBLIC: Bind all arguments to any SQL statement.
    • shouldCacheAllStatements

      public boolean shouldCacheAllStatements()
      PUBLIC: Cache all prepared statements, this requires full parameter binding as well.
    • shouldForceFieldNamesToUpperCase

      public boolean shouldForceFieldNamesToUpperCase()
      ADVANCED: Can be used if the app expects upper case but the database is not return consistent case, i.e. different databases.
    • shouldIgnoreCaseOnFieldComparisons

      public static boolean shouldIgnoreCaseOnFieldComparisons()
      ADVANCED: Allow for case in field names to be ignored as some databases are not case sensitive. When using custom this can be an issue if the fields in the descriptor have a different case.
    • shouldOptimizeDataConversion

      public boolean shouldOptimizeDataConversion()
      PUBLIC: Return if our driver level data conversion optimization is enabled. This can be disabled as some drivers perform data conversion themselves incorrectly.
    • shouldTrimStrings

      public boolean shouldTrimStrings()
      PUBLIC: By default CHAR field values have trailing blanks trimmed, this can be configured.
    • shouldUseBatchWriting

      public boolean shouldUseBatchWriting()
      PUBLIC: EclipseLink can be configured to use batch writing. This facility allows multiple write operations to be submitted to a database for processing at once. Submitting multiple updates together, instead of individually, can greatly improve performance in some situations.
    • shouldUseByteArrayBinding

      public boolean shouldUseByteArrayBinding()
      PUBLIC: EclipseLink can be configured to use parameter binding for large binary data. By default EclipseLink will print this data as hex through the JDBC binary escape clause. Both binding and printing have various limits on all databases (e.g. 5k - 32k).
    • shouldUseJDBCBatchWriting

      public boolean shouldUseJDBCBatchWriting()
      PUBLIC: Answers true if EclipseLink has JDBC batch writing enabled. This is the case if setUsesJDBCBatchWriting(true) has been called.
      Returns:
      boolean true if batch writing is delegated to the JDBC driver. Returns false if delegated to EclipseLink.
      See Also:
    • shouldUseNativeSequencing

      public boolean shouldUseNativeSequencing()
      PUBLIC: EclipseLink can be configured to use a sequence table or native sequencing to generate unique object IDs. Native sequencing uses the ID generation service provided by the database (e.g. SEQUENCE objects on Oracle and IDENTITY columns on Sybase). By default a sequence table is used. Using a sequence table is recommended as it supports preallocation. (Native sequencing on Sybase/SQL Server/Informix does not support preallocation. Preallocation can be supported on Oracle by setting the increment size of the SEQUENCE object to match the preallocation size.)
    • shouldUseNativeSQL

      public boolean shouldUseNativeSQL()
      PUBLIC: EclipseLink can be configured to use database-specific SQL grammar, as opposed to the JDBC standard grammar. This is because, unfortunately, some drivers to not support the full JDBC standard. By default EclipseLink uses the JDBC SQL grammar.
    • shouldUseStreamsForBinding

      public boolean shouldUseStreamsForBinding()
      PUBLIC: EclipseLink can be configured to use streams to store large binary data.
    • shouldUseStringBinding

      public boolean shouldUseStringBinding()
      PUBLIC: EclipseLink can be configured to bind large strings.
    • toString

      public String toString()
      PUBLIC: Print all of the connection information.
      Overrides:
      toString in class DatasourceLogin
    • useAccess

      public void useAccess()
      PUBLIC: Set the database platform to be Access.
    • useBatchWriting

      public void useBatchWriting()
      PUBLIC: EclipseLink can be configured to use batch writing. This facility allows multiple write operations to be submitted to a database for processing at once. Submitting multiple updates together, instead of individually, can greatly improve performance in some situations.
    • useByteArrayBinding

      public void useByteArrayBinding()
      PUBLIC: EclipseLink can be configured to use parameter binding for large binary data. By default EclipseLink will print this data as hex through the JDBC binary excape clause. Both binding and printing have various limits on all databases (e.g. 5k - 32k).
    • useCloudscape

      public void useCloudscape()
      PUBLIC: Set the database platform to be Cloudscape.
    • useDerby

      public void useDerby()
    • useCloudscapeDriver

      public void useCloudscapeDriver()
      PUBLIC: Use the Cloudscape JDBC driver.
    • useDB2

      public void useDB2()
      PUBLIC: Set the database platform to be DB2.
    • useDB2JDBCDriver

      public void useDB2JDBCDriver()
      PUBLIC: Use the IBM DB2 native client interface.
    • useDB2NetJDBCDriver

      public void useDB2NetJDBCDriver()
      PUBLIC: Use the IBM DB2 thin JDBC driver.
    • useDBase

      public void useDBase()
      PUBLIC: Set the database platform to be DBase.
    • useDefaultDriverConnect

      public void useDefaultDriverConnect()
      PUBLIC: Connect to the JDBC driver via DriverManager.
      See Also:
    • useDefaultDriverConnect

      public void useDefaultDriverConnect(String driverClassName, String driverURLHeader, String databaseURL)
      PUBLIC: Connect to the JDBC driver via DriverManager.
      See Also:
    • useDirectDriverConnect

      public void useDirectDriverConnect()
      PUBLIC: Some JDBC drivers don't support connecting correctly (via DriverManager), but do support connecting incorrectly (e.g. Castanet).
      See Also:
    • useDataSource

      public void useDataSource(String dataSource)
      PUBLIC: Specify the J2EE DataSource name to connect to. Also enable external connection pooling.
      See Also:
    • useJTADataSource

      public void useJTADataSource(String dataSource)
      PUBLIC: Specify the J2EE JTA enabled DataSource name to connect to. Also enable external transaction control and connection pooling.
      See Also:
    • useDirectDriverConnect

      public void useDirectDriverConnect(String driverClassName, String driverURLHeader, String databaseURL)
      PUBLIC: Some JDBC drivers don't support connecting correctly (via DriverManager), but do support connecting incorrectly (e.g. Castanet).
      See Also:
    • useExternalConnectionPooling

      public void useExternalConnectionPooling()
      PUBLIC: Use external connection pooling, such as WebLogic's JTS driver.
      Overrides:
      useExternalConnectionPooling in class DatasourceLogin
      See Also:
    • useExternalTransactionController

      public void useExternalTransactionController()
      PUBLIC: Use an external transaction controller such as a JTS service
      Overrides:
      useExternalTransactionController in class DatasourceLogin
      See Also:
    • useHSQL

      public void useHSQL()
      PUBLIC: Use the HSQL JDBC driver.
    • useHSQLDriver

      public void useHSQLDriver()
      PUBLIC: Use the HSQL JDBC driver.
    • useINetSQLServerDriver

      public void useINetSQLServerDriver()
      PUBLIC: Use the i-net SQL Server JDBC driver.
    • useInformix

      public void useInformix()
      PUBLIC: Set the database platform to be Informix.
    • useIntersolvSequeLinkDriver

      public void useIntersolvSequeLinkDriver()
      PUBLIC: Use the Intersolv/Merant SequeLink JDBC driver.
    • useJConnect50Driver

      public void useJConnect50Driver()
      PUBLIC: Use the Sybase JConnect JDBC driver.
    • useJConnectDriver

      public void useJConnectDriver()
      PUBLIC: Use the Sybase JConnect JDBC driver.
    • useJDBC

      public void useJDBC()
      PUBLIC: Set the database platform to be JDBC.
    • useJDBCBatchWriting

      public void useJDBCBatchWriting()
      PUBLIC: EclipseLink support batch writing in both JDK 1.1 abd JDK 1.2. In JDK 1.2 either the batch support provided by the JDBC driver can be used, or EclipseLink's built-in support, this allow for this to be set. By default the driver is used in JDK 1.2. Some JDBC 2 drivers to not support batching, so this lets are own batching be used.
    • useJDBCConnectDriver

      public void useJDBCConnectDriver()
      PUBLIC: Use the Borland JDBCConnect JDBC driver.
    • useJDBCConnectRemoteDriver

      public void useJDBCConnectRemoteDriver()
      PUBLIC: Use the Borland JDBCConnect JDBC driver.
    • useJDBCODBCBridge

      public void useJDBCODBCBridge()
      PUBLIC: User the Sun/Merant JDBC-ODBC bridge driver.
    • useMySQL

      public void useMySQL()
      PUBLIC: Set the database platform to be MySQL.
    • useNativeSequencing

      public void useNativeSequencing()
      PUBLIC: EclipseLink can be configured to use a sequence table or native sequencing to generate unique object IDs. Native sequencing uses the ID generation service provided by the database (e.g. SEQUENCE objects on Oracle and IDENTITY columns on Sybase). By default a sequence table is used. Using a sequence table is recommended as it supports preallocation. (Native sequencing on Sybase/SQL Server/Informix does not support preallocation. Preallocation can be supported on Oracle by setting the increment size of the SEQUENCE object to match the preallocation size.)
    • useNativeSQL

      public void useNativeSQL()
      PUBLIC: EclipseLink can be configured to use database-specific SQL grammar, as opposed to the JDBC standard grammar. This is because, unfortunately, some drivers to not support the full JDBC standard. By default EclipseLink uses the JDBC SQL grammar.
    • useOracle

      public void useOracle()
      PUBLIC: Set the database platform to be Oracle.
    • useOracle7JDBCDriver

      public void useOracle7JDBCDriver()
      PUBLIC: Use the Oracle 7.x native OCI JDBC driver.
    • useOracleJDBCDriver

      public void useOracleJDBCDriver()
      PUBLIC: Use the Oracle 8.x native OCI JDBC driver.
    • useOracleServerJDBCDriver

      public void useOracleServerJDBCDriver()
      PUBLIC: Use the Oracle server JDBC driver.
    • useOracleThinJDBCDriver

      public void useOracleThinJDBCDriver()
      PUBLIC: Use the Oracle thin JDBC driver.
    • usePointBase

      public void usePointBase()
      PUBLIC: Set the database platform to be PointBase.
    • usePointBaseDriver

      public void usePointBaseDriver()
      PUBLIC: Use the PointBase JDBC driver.
    • useSQLServer

      public void useSQLServer()
      PUBLIC: Set the database platform to be SQL Server.
    • useSymfoware

      public void useSymfoware()
      PUBLIC: Set the database platform to be Symfoware.
    • useStreamsForBinding

      public void useStreamsForBinding()
      PUBLIC: EclipseLink can be configured to use streams to store large binary data.
    • useStringBinding

      public void useStringBinding()
      PUBLIC: Bind strings larger than 255 characters.
    • useStringBinding

      public void useStringBinding(int size)
      PUBLIC: Bind strings that are larger than the specified size. Strings that are smaller will not be bound.
    • useSybase

      public void useSybase()
      PUBLIC: Set the database platform to be Sybase.
    • useWebLogicDriverCursoredOutputCode

      public void useWebLogicDriverCursoredOutputCode()
      PUBLIC: Set the prepare cursor code to what the WebLogic Oracle OCI JDBC driver expects.
    • useWebLogicJDBCConnectionPool

      public void useWebLogicJDBCConnectionPool(String poolName)
      PUBLIC: Set a WebLogic JDBC connection pool (a pool must be defined for the entity beans that are to be deployed)
    • useWebLogicOracleOCIDriver

      public void useWebLogicOracleOCIDriver()
      PUBLIC: Use the WebLogic Oracle OCI JDBC driver.
    • useWebLogicSQLServerDBLibDriver

      public void useWebLogicSQLServerDBLibDriver()
      PUBLIC: Use the WebLogic SQL Server dblib JDBC driver.
    • useWebLogicSQLServerDriver

      public void useWebLogicSQLServerDriver()
      PUBLIC: Use the WebLogic SQL Server JDBC driver.
    • useWebLogicSybaseDBLibDriver

      public void useWebLogicSybaseDBLibDriver()
      PUBLIC: Use the WebLogic Sybase dblib JDBC driver.
    • useWebLogicThinClientDriver

      public void useWebLogicThinClientDriver()
      PUBLIC: Use the WebLogic thin client JDBC driver.
    • useWebLogicThinDriver

      public void useWebLogicThinDriver()
      PUBLIC: Use the WebLogic thin JDBC driver.
    • getDelayBetweenConnectionAttempts

      public int getDelayBetweenConnectionAttempts()
      PUBLIC: Returns the number of milliseconds that EclipseLink will wait between attempts to reconnect a DatabaseConnection in the case EclipseLink is attempting to retry a query, the default is 5000. EclipseLink will retry a read query outside of a transaction if EclipseLink can determine that a communication error occured with the database.
    • setDelayBetweenConnectionAttempts

      public void setDelayBetweenConnectionAttempts(int delayBetweenConnectionAttempts)
      PUBLIC: Stores the number of milliseconds that EclipseLink will wait between attempts to reconnect a DatabaseConnection in the case EclipseLink is attempting to retry a query. EclipseLink will retry a read query outside of a transaction if EclipseLink can determine that a communication error occurred with the database.
    • isConnectionHealthValidatedOnError

      public boolean isConnectionHealthValidatedOnError(org.eclipse.persistence.internal.databaseaccess.DatabaseCall call, org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor accessor)
      INTERNAL: Validate if set, or no timeout.
    • isConnectionHealthValidatedOnError

      public boolean isConnectionHealthValidatedOnError()
      PUBLIC: On an SQL Exception EclipseLink will ping the database to determine if the connection used can continue to be used for queries. This should have no impact on applications unless the user is using pessimistic locking queries with 'no wait' or are using a query timeout feature. If that is the case and the application is experiencing a performance impact from the health check then this feature can be turned off. Turning this feature off will prevent EclipseLink from being able to retry queries in the case of database failure. By default (null) connection health is validate if the query does not have a timeout, and there is a ping string. Setting to true or false overrides this.
      Specified by:
      isConnectionHealthValidatedOnError in interface Login
      Overrides:
      isConnectionHealthValidatedOnError in class DatasourceLogin
    • setConnectionHealthValidatedOnError

      public void setConnectionHealthValidatedOnError(boolean isConnectionHealthValidatedOnError)
      PUBLIC: On an SQL Exception EclipseLink will ping the database to determine if the connection used can continue to be used for queries. This should have no impact on applications unless the user is using pessimistic locking queries with 'no wait' or are using a query timeout feature. If that is the case and the application is experiencing a performance impact from the health check then this feature can be turned off. Turning this feature off will prevent EclipseLink from being able to retry queries in the case of database failure. By default (null) connection health is validate if the query does not have a timeout, and there is a ping string. Setting to true or false overrides this.