Database Exceptions (4002 – 4018)
DatabaseException
is a run-time exception that is raised when data read from the database, or the data that is to be written to the database, is incorrect. The exception may also act as a wrapper for SQLException
. If this is the case, the message contains a reference to the error code and error message, as shown in Example 13-4.
This exception can occur on any database operation. If an execution of a SQL script is involved in a database operation causing DatabaseException, the exception's message, accessible through the getMessage
method, contains the SQL that caused this exception.
This exception includes internal exception and error code information when the exception is wrapping a SQLException
.
Format
EXCEPTION [TOPLINK – error code]: Exception name
EXCEPTION DESCRIPTION: Message
INTERNAL EXCEPTION: Message
ERROR CODE: Error code
Example 13-4 Database Exception
EXCEPTION [TOPLINK – 4002]: oracle.toplink.exceptions.DatabaseException
EXCEPTION DESCRIPTION: java.sql.SQLException: [INTERSOLV][ODBC dBase driver] Incompatible datatypes in expression: >
INTERNAL EXCEPTION: java.sql.SQLException: [INTERSOLV][ODBC dBase driver] Incompatible datatypes in expression: >
ERROR CODE: 3924
-
4002: SQL_EXCEPTION
-
Cause: A SQL exception was encountered, raised by the underlying JDBC bridge. TopLink wraps only that exception.
-
Action: Inspect the internal exception that was raised.
-
4003: CONFIGURATION_ERROR_CLASS_NOT_FOUND
-
Cause: The driver class name was not found.
-
Action: Verify the class name given in JDBCLogin
.
-
4005: DATABASE_ACCESSOR_NOT_CONNECTED
-
Cause: The session is not connected to the database while attempting to read or write on the database.
-
Action: An application may have to log in again because the connection to the database might have been lost.
-
4006: ERROR_READING_BLOB_DATA
-
Cause: An error occurred reading BLOB data from the database. There are two possibilities for this exception: either the BLOB data was not read properly from the result set or TopLink cannot process the BLOB data using ByteArrayOutputStream
.
-
Action: Verify whether the underlying driver supports BLOBs properly. If it does, then report this problem to Oracle Support Services.
-
4007: COULD_NOT_CONVERT_OBJECT_TYPE
-
Cause: Cannot convert object type on internal error.java.sql.TYPES = type
. The object from the result set cannot be converted to the type that was returned from the metadata information.
-
Action: Verify whether the underlying driver supports the conversion type properly. If it does, then report this problem to Oracle Support Services.
-
4008: LOGOUT_WHILE_TRANSACTION_IN_PROGRESS
-
Cause: An attempt has been made to log out while the transaction is still in progress. You cannot log out while a transaction is in progress.
-
Action: Wait until the transaction is finished.
-
4009: SEQUENCE_TABLE_INFORMATION_NOT_COMPLETE
-
Cause: The sequence information given to TopLink is not sufficiently complete to get the set of sequence numbers from the database. This usually happens on native sequencing (see
Understanding Sequencing in Relational Projects) on an Oracle database.
-
Action: Verify the data provided, especially the sequence name provided in TopLink.
-
4011: ERROR_PREALLOCATING_SEQUENCE_NUMBERS
-
Cause: An error occurred preallocating sequence numbers on the database; the sequence table information is not complete.
-
Action: Ensure the sequence table was properly created on the database.
-
4014: CANNOT_REGISTER_SYNCHRONIZATIONLISTENER_FOR_UNITOFWORK
-
Cause: TopLink cannot register the synchronization listener: underlying_exception_string. When the TopLink session is configured with an ExternalTransactionController
, any unit of work requested by a client must operate within the context of a JTS external global transaction. When a unit of work is created and the external global transaction is not in existence, or if the system cannot acquire a reference to it, this error is reported.
-
Action: Verify that a JTS transaction is in progress before acquiring the unit of work.
-
4015 SYNCHRONIZED_UNITOFWORK_DOES_NOT_ SUPPORT_COMMITANDRESUME
-
Cause: A synchronized
UnitOfWork
does not support the
commitAndResume
operation. When the TopLink session is configured with an
ExternalTransactionController
, any unit of work requested by a client must operate within the context of a JTS external global transaction (see
4014: CANNOT_REGISTER_SYNCHRONIZATIONLISTENER_FOR_UNITOFWORK). The JTS specification does not support the concept of check pointing a transaction—that is, committing the work performed and then continuing to work within the same transaction context. JTS does not support nested transactions, either. As a result, if a client code invokes
commitAndResume()
on a synchronized unit of work, this error is reported.
-
Action: None required.
-
4016: CONFIGURATION_ERROR_NEW_INSTANCE_ INSTANTIATION_EXCEPTION
-
Cause: A configuration error occurred when TopLink attempted to instantiate the given driver class. TopLink cannot instantiate the driver.
-
Action: Check the driver.
-
4017: CONFIGURATION_ERROR_NEW_INSTANCE_ILLEGAL_ACCESS_EXCEPTION
-
Cause: A configuration error occurred when TopLink attempted to instantiate the given driver class
. TopLink cannot instantiate the driver.
-
Action: Check the driver.
-
4018: TRANSACTION_MANAGER_NOT_SET_FOR_JTS_DRIVER
-
Cause: The transaction manager has not been set for the JTSSynchronizationListener
.
-
Action: Set a transaction manager for the JTSSynchronizationListener
.