java.lang.Object java.lang.Throwable java.lang.Exception java.sql.SQLException com.ibm.db.beans.DBException
public class DBException
extends SQLException
DBException represents exceptions that are raised by classes in com.ibm.db.beans package.
Field | Description |
---|---|
alreadyConnected | Error code if cannot connect to database because already connected. |
badPropertyValue | Error code if you attempt to set a property to an invalid value. |
badUidPwd | Error code if the username and password specified are not valid. |
cacheEmpty | Error code if the result set cache is empty. |
cannotConvert | Error code if a String value cannot be converted to an object of another class. |
cannotConvertToString | Error code if cannot convert a column value to a String. |
cannotRefreshData | Error code if cannot refresh data in a row because the row cannot be found in the database. |
cannotScrollBack | Error code if cannot refetch rows displaced from the cache. |
cannotSetAfterExecute | Error code if the property cannot be set after executing. |
columnAlreadyDefined | Error code if the column with the specified number has already been defined. |
columnNotDefined | Error code if the column with the specified number has not yet been defined. |
connectionClosed | Error code if the java.sql.Connection you pass to the
setConnection method is not open. |
dbbaseDriverNotFound | Error code if the JDBC DriverManager is unable to find a driver. |
dbDuplicateColumn | Error code if the specified column is already defined. |
dbDuplicateParm | Error code if the specified paramenter is already defined. |
dbNotExecuted | Error code if the SQL statement has not been executed. |
decodeError | Error code if a password cannot be decoded. |
driverNotFound | Error code if the JDBC DriverManager is unable to find a driver. |
duplicateColumn | Error code if the column name was already used. |
duplicateParm | Error code if the parameter name was already used. |
GENERIC_SQLSTATE | Generic SQLState used for all DBExceptions. |
inconsistentColumnCount | Error code if more columns were described than were actually returned. |
inconsistentColumnName | Error code if a column has a different name than was specified in its meta data description. |
indexTooLarge | Error code if the specified row index exceeds the allowable range. |
invalidColumnNumber | Error code if the specified column number is less than 1. |
invalidDeferralStyle | Error code if you attempt to set the updateDeferral property of a DBSelect to an invalid value. |
invalidDirection | Error code if the specified fetch direction is neither FETCH_FORWARD (1000) nor FETCH_REVERSE (1001). |
invalidParameterNumber | Error code if the specified parameter number is less than 1. |
invalidResourceLevel | Error code if an invalid resource level is specified. |
invalidResultNumber | Error code if the specified result number is less than 1. |
invalidRowNumber | Error code if the specified row number is less than 1. |
invalidSize | Error code if the specified value for a property representing size is a negative number. |
keyColumnMustBeSearchable | Error code if a column identified as part of a key has a datatype that is not searchable. |
lockNotSupported | Error code if method lockRow not supported for database product. |
malformedUrl | Error code if unable to create java.net.URL from String object. |
metaDataNotYetAvailable | Error code if meta-data information is not yet available. |
multipleTables | Error code if result set is from multiple tables and update, delete or insert was requested. |
mustApplyDeferredUpdates | Error code if you attempt to change the update deferral style of a DBSelect when there are already pending deferred updates. |
mustApplyRowValueChanges | Error code if you attempt to change the update deferral style of a DBSelect when value changes have been made in the current row, but not yet applied by performing updateRow() or moving to anther row. |
noActiveConnection | Error code if the connection is not active. |
noColumnUpdate | Error code if you attempt to set a value in a column which is not enabled for updates. |
noConnection | Error code if there is an internal error. |
noCurrentResult | Error code if operation is attempted that requires that you be positioned on a result set and you are not. |
noDeferralWithAutomaticLocking | Error code if you attempt to put automatic row locking and the deferral of updates into effect simultaneously. |
noDeferralWithLockedRow | Error code if you attempt an operation that will cause a row to be locked in the database while the deferral of updates is in effect. |
noInitialContext | Error code if cannot connect to the database because the InitialContext cannot be created. |
noLogWriter | Error code if trace is turned on and the LogWriter is null. |
noResults | Error code if the result set is empty. |
noResultSets | Error code if there are no result sets. |
noSearchableColumns | Error code if no searchable columns are in the result set. |
noSelectObject | Error code if no DBSelect is associated with a DBTableModel. |
noSQL | Error code if the command property of a DBStatement is null or the empty string when the statement is executed. |
noStatement | Error code if there is an internal error. |
noTableDefined | Error code if the bean cannot identify the correct table in order to lock, update, insert, or delete a row, or to re-fetch data from it. |
notCall | Error code if the SQL statement is not a CALL statement. |
notExecuted | Error code if the SQL statement has not been executed. |
notExecuting | Error code if execution of the SQL statement cannot be canceled because the statement is not executing. |
notOpen | Error code if the result set is not open. |
noTransactions | Error code if autoCommit false not supported for database product. |
notSelect | Error code if the SQL statement is not a SELECT statement. |
noValuesSet | Error code if cannot insert because no values were set. |
parameterAlreadyDefined | Error code if the parameter in the specified position has already been defined. |
parameterNotDefined | Error code if the parameter in the specified position has not yet been defined. |
readOnly | Error code if the result set is read only. |
resultNotDefined | Error code if the result in the specified position has not yet been defined. |
resultNotFound | Error code if more result sets were described than were actually returned. |
rowChanged | Error code if the current row cannot be updated or deleted because no matching row could be found in the database. |
rowFlaggedForDelete | Error code if deferred changes for a DBSelect include a delete of the current row, and you then attempt to set values in the row. |
rowNotFound | Error code if a lock cannot be obtained on the current row because no matching row could be found in the database. |
rowNotInDatabase | Error code if the specified row is not in the database. |
sqlException | Error code if an SQLException occurred. |
transactionIsolationError | Error code if can't set transaction isolation level. |
truncated | Error code if cannot perform operation because data truncation occurred when row was retrieved. |
unexpectedError | Error code if an unexpected error occurs. |
wrongObjectType | Error code if the value used to set a column or parameter is of a different Java class than specified in the meta data. |
Constructor | Description |
---|---|
DBException() | DBException constructor comment. |
DBException(String) | DBException constructor comment. |
DBException(String, String) | DBDataException constructor comment. |
DBException(String, String, int) | DBDataException constructor comment. |
Method | Description |
---|---|
int getErrorCode() | Returns the error code associated with the exception. |
public static final int alreadyConnectedError code if cannot connect to database because already connected.
public static final int badPropertyValueError code if you attempt to set a property to an invalid value.
public static final int badUidPwdError code if the username and password specified are not valid. This can occur when you try to connect to the database.
public static final int cacheEmptyError code if the result set cache is empty. This can occur if there are rows available to be acted upon, but none is currently in the cache. This should only occur if the cache size has been limited, and deletions have temporarily emptied the cache. Use next(), previous(), or fetchMoreRows() to get more rows into the cache.
public static final int cannotConvertError code if a String value cannot be converted to an object of another class. This occurs if the String value passed in
setColumnFromString
orsetParameterFromString
cannot be converted to an object of the appropriate type for the column or parameter.
public static final int cannotConvertToStringError code if cannot convert a column value to a String. This can happen if the cache contains a binary value, or if it contains a java.io.InputStream and an IOException occurs reading it, or if it contains a Clob which has been invalidated (by a commit for example). If you set the option
validateLOBs
, the bean will try to re-fetch any invalid Clobs or Blobs before reporting this error. However, under some circumstances, the re-fetch may fail. For example, it will fail if you are no longer connected to the database, or if the value you are getting was originally set by you, not fetched from the database via this result set.
public static final int cannotRefreshDataError code if cannot refresh data in a row because the row cannot be found in the database. This can happen when you use the
refreshRow
method and the row cannot be found in the database. It can also happen when you attempt to get a column value stored in the cache as a Clob or Blob which has become invalid (due to a commit occuring, for example), and you have set thevalidateLOBs
option to cause an attempt to refresh the value from the database, but the row cannot be found. A variety of conditions may prevent a row from being found. It could have been changed in the database independently of this object after the row data was retrieved. Data for one or more columns in the row could have been truncated or reformatted when retrieved from the database, and therefore not match the database. For example, decimal data is truncated when retrieved as an integer, timestamp data is truncated when retrieved as a date, and a date stored as a string in the database may be reformatted when retrieved as a date.
public static final int cannotScrollBackError code if cannot refetch rows displaced from the cache. This can occur when you use row movement methods to move to a row that has been displaced from the cache or you use the
fetchMoreRows(FETCH_REVERSE)
method to fetch rows before the first row currently in the cache. In these cases, the exception occurs if the resultset is not read-only, or if the underlying database driver does not support scrollable cursors (a JDBC 2.0 feature).
public static final int cannotSetAfterExecuteError code if the property cannot be set after executing. This error can occur when you first execute your SQL statement and then attempt to set a property such as optimizeConvertToString, that can only take effect before execution.
public static final int columnAlreadyDefinedError code if the column with the specified number has already been defined. This can occur if you use a setColumnXXX method to implicitly define a column and set its XXX property, and then use the setColumn convenience method to set all of its primary settable properties. The setColumn method is intended to set multiple properties of a newly defined column, not to change properties of an already defined column.
public static final int columnNotDefinedError code if the column with the specified number has not yet been defined.
public static final int connectionClosedError code if the java.sql.Connection you pass to the
setConnection
method is not open. It is not possible to use a Connection object which is closed.
public static final int dbbaseDriverNotFoundError code if the JDBC DriverManager is unable to find a driver. This can occur when you try to connect to the database if you specified values for the url and driverName properties and the DriverManager cannot find the class you specified in the driverName property.
public static final int dbDuplicateColumnError code if the specified column is already defined. This error can occur when you use the
addColumn
method to add a column description to a StatementMetaData object, but it already has a column with the specified name.
public static final int dbDuplicateParmError code if the specified paramenter is already defined. This error can occur when you use the
addParameter
method to add a parameter description to a StatementMetaData object, but it already has a parameter with the specified name.
public static final int dbNotExecutedError code if the SQL statement has not been executed. This occurs if the operation you have requested requires that the statement has been executed but it has not.
public static final int decodeErrorError code if a password cannot be decoded. This can occur if you use
setPassword(String, boolean)
passing an encoded password and the value true, but the password cannot be decoded.
public static final int driverNotFoundError code if the JDBC DriverManager is unable to find a driver. This can occur when you try to connect to the database if you specified values for the url and driverName properties and the DriverManager cannot find the class you specified in the driverName property.
public static final int duplicateColumnError code if the column name was already used. This error can occur when you attempt to set the name or label of a column in the DBSelectMetaData object to a value that has already been used. (It is the label which must be unique, but if you have not set the label, it defaults to the name.)
public static final int duplicateParmError code if the parameter name was already used. This error can occur when you attempt to set the name of a parameter in the DBSelectMetaData object to a value that has already been used.
public static final java.lang.String GENERIC_SQLSTATEGeneric SQLState used for all DBExceptions.
public static final int inconsistentColumnCountError code if more columns were described than were actually returned. This can occur if you describe columns in a DBSelectMetaData object before executing, and the result set after executing actually contains fewer columns than described.
public static final int inconsistentColumnNameError code if a column has a different name than was specified in its meta data description. This can occur when you execute a DBSelect if a column name you provided in a DBSelectMetaData object before executing is different than the column name found in the java.sql.ResultSetMetaData object after executing.
public static final int indexTooLargeError code if the specified row index exceeds the allowable range. This can occur if you specify a row number greater than the last row in the cache when calling the
getCacheValueAt
orsetCacheValueAt
method of DBSelect.
public static final int invalidColumnNumberError code if the specified column number is less than 1.
public static final int invalidDeferralStyleError code if you attempt to set the updateDeferral property of a DBSelect to an invalid value. Valid values are DEFER_NOTHING, DEFER_WRITE_TO_DATABASE, and DEFER_WRITE_TO_DATABASE_AND_ROW_NUMBER_CHANGE.
public static final int invalidDirectionError code if the specified fetch direction is neither FETCH_FORWARD (1000) nor FETCH_REVERSE (1001).
public static final int invalidParameterNumberError code if the specified parameter number is less than 1.
public static final int invalidResourceLevelError code if an invalid resource level is specified. This error can occur when you specify an invalid value for the resource level parameter on the close(int) or isOpen(int) methods.
public static final int invalidResultNumberError code if the specified result number is less than 1.
public static final int invalidRowNumberError code if the specified row number is less than 1.
public static final int invalidSizeError code if the specified value for a property representing size is a negative number.
public static final int keyColumnMustBeSearchableError code if a column identified as part of a key has a datatype that is not searchable. This can occur when you execute a DBSelect if you indicated in a DBSelectMetaData object that a column is part of a key for uniquely identifying rows in the result set, but the datatype of the column is not searchable.
public static final int lockNotSupportedError code if method
lockRow
not supported for database product. ThelockRow
method is not supported for Oracle, Microsoft SQL Server, Sybase SQL Server, and databases which do not support positioned updates and deletes (as reported in the JDBC DatabaseMetaData).
public static final int malformedUrlError code if unable to create java.net.URL from String object. This error can occur when you have mapped a resultset column to the type DATALINK, but the String object retrieved from the database is not a well-formed url.
public static final int metaDataNotYetAvailableError code if meta-data information is not yet available. Certain meta-data properties are not available until the statement has been executed.
public static final int multipleTablesError code if result set is from multiple tables and update, delete or insert was requested. The columns of the result set must come from a single table to perform these operations.
public static final int mustApplyDeferredUpdatesError code if you attempt to change the update deferral style of a DBSelect when there are already pending deferred updates. You must apply any deferred updates by using the applyUpdates() method before changing the update deferral style.
public static final int mustApplyRowValueChangesError code if you attempt to change the update deferral style of a DBSelect when value changes have been made in the current row, but not yet applied by performing updateRow() or moving to anther row.
public static final int noActiveConnectionError code if the connection is not active. This occurs if the operation you have requested requires that the connection to the database be open, but it is not.
public static final int noColumnUpdateError code if you attempt to set a value in a column which is not enabled for updates. This can occur when the
DBSelectMetaData.setUpdateEnabled
method has been used to disable updates for the column whose value you tried to set.
public static final int noConnectionError code if there is an internal error.
public static final int noCurrentResultError code if operation is attempted that requires that you be positioned on a result set and you are not. If you are executing a stored procedure, it may be that it did not return results, or that the current result is an update count instead of a result set.
public static final int noDeferralWithAutomaticLockingError code if you attempt to put automatic row locking and the deferral of updates into effect simultaneously. When you set the updateDeferral property of a DBSelect to DEFER_WRITE_TO_DATABASE or DEFER_WRITE_TO_DATABASE_AND_ROW_NUMBER_CHANGE, its lockRows property must be false. When you set the lockRows property of a DBSelect to true, its updateDeferral property must be set to DEFER_NOTHING.
public static final int noDeferralWithLockedRowError code if you attempt an operation that will cause a row to be locked in the database while the deferral of updates is in effect. When you set the updateDeferral property of a DBSelect to DEFER_WRITE_TO_DATABASE or DEFER_WRITE_TO_DATABASE_AND_ROW_NUMBER_CHANGE, the current row must not be locked. When you explicitly lock the current row, the updateDeferral property must be set to DEFER_NOTHING.
public static final int noInitialContextError code if cannot connect to the database because the InitialContext cannot be created. This can occur when you try to connect to the database if you specified a value for the dataSourceName property and the initial context factory cannot create an InitialContext to use as the starting point for finding the DataSource.
public static final int noLogWriterError code if trace is turned on and the LogWriter is null.
public static final int noResultsError code if the result set is empty. This occurs if there are no rows in the result set and you try to perform an operation on the current row, or obtain values from a specific row via the
getCacheValueAt
method of DBSelect.
public static final int noResultSetsError code if there are no result sets. This occurs if the DBProcedureCall has no result sets and you try to set the current result set or perform an operation on the current result set.
public static final int noSearchableColumnsError code if no searchable columns are in the result set. This can occur when the bean trys to locate a row in the database in order to lock it, update it, delete it, or to re-fetch data from it. The result set needs to contain at least enough searchable columns to uniquely identify a row.
public static final int noSelectObjectError code if no DBSelect is associated with a DBTableModel. This error can occur when execute methods of the DBTableModel before there is an associated DBSelect object.
public static final int noSQLError code if the command property of a DBStatement is null or the empty string when the statement is executed. The command property must contain a valid SQL statement.
public static final int noStatementError code if there is an internal error.
public static final int noTableDefinedError code if the bean cannot identify the correct table in order to lock, update, insert, or delete a row, or to re-fetch data from it. This can occur if your DBSelectMetaData object does not specify the table for update and the bean fails to identify a table by parsing your query.
public static final int notCallError code if the SQL statement is not a CALL statement. This occurs when you execute a DBProcedureCall if the SQL specified in its command property is not a CALL statement.
public static final int notExecutedError code if the SQL statement has not been executed. This occurs if the operation you have requested requires that the statement has been executed but it has not.
public static final int notExecutingError code if execution of the SQL statement cannot be canceled because the statement is not executing. You may get this exception when using the
cancelAction
method to cancel a statement you are executing via theexecute
method or a statement you are executing via theupdateRow
ordeleteRow
methods.The
cancelAction
method must be invoked from a thread other than the one in which the statement is executing, while the statment is executing.
public static final int notOpenError code if the result set is not open. This occurs if the operation you have requested requires that the result set be open, but it is closed.
public static final int noTransactionsError code if autoCommit false not supported for database product. This can occur either when setting autoCommit to false while connected, or when connecting to the database after having set autoCommit to false.
public static final int notSelectError code if the SQL statement is not a SELECT statement. This occurs when you execute a DBSelect if the SQL specified in its command property is not a SELECT statement.
public static final int noValuesSetError code if cannot insert because no values were set. This occurs when you invoke
updateRow
for a row added to the result set vianewRow
in which you have not yet set any values.
public static final int parameterAlreadyDefinedError code if the parameter in the specified position has already been defined. This can occur if you use a setParameterXXX method to implicitly define a parameter and set its XXX property, and then use the setParameter convenience method to set all of its primary settable properties. The setParameter method is intended to set multiple properties of a newly defined parameter, not to change properties of an already defined parameter.
public static final int parameterNotDefinedError code if the parameter in the specified position has not yet been defined.
public static final int readOnlyError code if the result set is read only. This occurs if the readOnly property has been set for the DBSelect and you attempt an operation that would change the database (such as
deleteRow
) or would lead to changing the database later (such assetColumn
).
public static final int resultNotDefinedError code if the result in the specified position has not yet been defined.
public static final int resultNotFoundError code if more result sets were described than were actually returned. This can occur if you provide meta data for more result sets than a stored procedure actually returns. The error may be discovered either when you execute, or when you attempt to move past the last result set, depending on your setting of the fetchAllResultsOnExecute property.
public static final int rowChangedError code if the current row cannot be updated or deleted because no matching row could be found in the database. This can happen for a variety of reasons. The row could have been changed in the database independently of this object after the row data was retrieved. Data for one or more columns in the row could have been truncated or reformatted when retrieved from the database, and therefore not match the database. For example, decimal data is truncated when retrieved as an integer, timestamp data is truncated when retrieved as a date, and a date stored as a string in the database may be reformatted when retrieved as a date.
public static final int rowFlaggedForDeleteError code if deferred changes for a DBSelect include a delete of the current row, and you then attempt to set values in the row.
public static final int rowNotFoundError code if a lock cannot be obtained on the current row because no matching row could be found in the database. This can happen for a variety of reasons. The row could have been changed in the database independently of this object after the row data was retrieved. Data for one or more columns in the row could have been truncated or reformatted when retrieved from the database, and therefore not match the database. For example, decimal data is truncated when retrieved as an integer, timestamp data is truncated when retrieved as a date, and a date stored as a string in the database may be reformatted when retrieved as a date. These cases may go undetected since the database may not flag them with a warning.
public static final int rowNotInDatabaseError code if the specified row is not in the database. This occurs if you try to use the
lockRow
method on a row you added to the result set vianewRow
before you have inserted it into the database. A row that is not in the database cannot be locked.
public static final int sqlExceptionError code if an SQLException occurred. When this exception occurs, you can use the method
getSQLException
to get the SQLException itself, and examine its contents.
public static final int transactionIsolationErrorError code if can't set transaction isolation level. This can occur either when setting the transactionIsolation property while connected, or when connecting to the database after having set the transactionIsolation property.
public static final int truncatedError code if cannot perform operation because data truncation occurred when row was retrieved. This can occur when you attempt
deleteRow
orsetColumn
and a truncation warning was raised by the database when the row was fetched. If data was truncated, it will not be possible to find the correct row in the database to perform an update or delete.
public static final int unexpectedErrorError code if an unexpected error occurs. The message for this exception includes a String rendering of the exception.
public static final int wrongObjectTypeError code if the value used to set a column or parameter is of a different Java class than specified in the meta data.
public DBException()DBException constructor comment.
public DBException(String reason)DBException constructor comment.
- Parameters
- reason - java.lang.String
public DBException(String reason, String sQLState)DBDataException constructor comment.
- Parameters
- reason - java.lang.String
- sQLState - java.lang.String
public DBException(String reason, String sQLState, int errorCode)DBDataException constructor comment.
- Parameters
- reason - java.lang.String
- sQLState - java.lang.String
- vendorCode - int
public int getErrorCode()Returns the error code associated with the exception.
- Returns
- int
- Overrides
- getErrorCode in class SQLException