com.ibm.db
Class DataException

java.lang.Object
  |
  +--java.lang.Throwable
        |
        +--java.lang.Exception
              |
              +--com.ibm.db.DataException

public class DataException
extends java.lang.Exception

DataException represents exceptions that are raised by classes in com.ibm.db package.

See Also:
Serialized Form

Field Summary
static int alreadyConnected
          Error code if cannot connect to database because already connected.
static int badJavaClass
          Error code if an invalid Java Class specified.
static int badSQLType
          Error code if an invalid/unsupported SQL type is specified.
static int badUidPwd
          Error code if an invalid userID or password specified.
static int beforeCacheStart
          Error code if the specified row is before the start of the cache.
static int beforeResultCacheStart
          Error code if the specified result set is before the start of the cache.
static int cannotConvert
          Error code if a String value cannot be converted to an object of another class.
static int cannotConvertToString
          Error code if cannot convert a column value to a String.
static int cannotRefreshData
          Error code if cannot refresh data in a row because the row cannot be found in the database.
static int cloneNotSupported
          Error code if the object does not support cloning.
static int connectionClosed
          Error code if the JDBC connection you pass to the DatabaseConnection constructor is not open.
private static java.lang.String copyright
           
static int decodeError
          Error code if a decode error encountered.
static int driverNotFound
          Error code if the JDBC driver class not found when attempting to connect.
static int duplicateColumn
          Error code if the specified column is already defined.
static int duplicateParm
          Error code if the specified paramenter is already defined.
protected  int errCode
           
static int errorMakeField
          Error code if an unsupported Java class specified for column/parameter.
static int externallyManaged
          Error code if the connection is externally managed.
protected  java.sql.SQLException fieldSQLException
           
static int illegalAccess
          Error code if the newInstance method of a Class object fails because the class or initializer is not accessible.
static int inconsistentColumnCount
          Error code if the number of columns in a result set does not match the number of columns specified in the StatementMetaData.
static int inconsistentColumns
          Error code if the defined columns are inconsistent with SQL statement.
static int inconsistentColumnType
          Error code if the SQL data types of columns in a result set do not match the SQL data types of columns specified in the StatementMetaData.
static int indexTooLarge
          Error code if the specified row index exceeds the allowable range.
static int instantiationException
          Error code if the newInstance method of a Class object fails because the Class object is abstract or an interface.
static int internalError
          Error code if an internal error occurred.
static int invalidConnPoolType
          Error code if an invalid connection pool type was specified.
static int lockNotSupported
          Error code if method lockRow not supported for database product.
static int maxSize
          Error code if newRow failed because result set max size limit reached.
static int multipleTables
          Error code if result set is from multiple tables and update, delete or insert was requested.
static int noActiveConnection
          Error code if the connection is not active.
static int noConnection
          Error code if there is no associated DatabaseConnection.
static int noConnectionSpec
          Error code if an error occured creating a DatabaseConnectionSpec.
static int noGui
          Error code if no GUI is available.
static int noLogonSpec
          Error code if an error occured creating a DatabaseLogonSpec.
static int noMetaData
          Error code if there is no associated StatementMetaData.
static int noResults
          Error code if the result set is empty.
static int noResultSets
          Error code if there are no result sets.
static int noSearchableColumns
          Error code if no searchable columns are in the result set.
static int noSQL
          Error code if no SQL Statement is specified.
static int noStatement
          Error code if there is no associated Statement object.
static int noStatementMetaData
          Error code if an error occurred creating StatementMetaData.
static int noSuchColumn
          Error code if the specified column is not defined.
static int noSuchParm
          Error code if the specified parameter is not defined.
static int noSuchTable
          Error code if the specified table is not defined.
static int noTableDefined
          Error code if the bean cannot identify the correct table(s) in order to lock, update, insert, or delete a row, or to re-fetch data from it.
static int notCall
          Error code if the SQL statement is not a CALL statement.
static int notExecuted
          Error code if the SQL statement has not been executed.
static int notExecuting
          Error code if execution of the SQL statement cannot be canceled because the statement is not executing.
static int notOpen
          Error code if the result set is not open.
static int noTransactions
          Error code if autoCommit false not supported for database product.
static int notRegistered
          Error code if the connection alias is not registered.
static int notSelect
          Error code if the SQL statement is not a SELECT statement.
static int noValuesSet
          Error code if cannot insert because no values were set.
static int readOnly
          Error code if the result set is read only.
static int resultIndexTooLarge
          Error code if the specified result set index exceeds the allowable range.
static int rowChanged
          Error code if the current row cannot be updated or deleted because no matching row could be found in the database.
static int rowNotFound
          Error code if a lock cannot be obtained on the current row because no matching row could be found in the database.
static int rowNotInDatabase
          Error code if the specified row is not in the database.
static int SQLDisconnectException
          Error code if an exception occurred during disconnect.
static int sqlException
          Error code if an SQLException occurred.
static int transactionIsolationError
          Error code if can't set transaction isolation level
static int truncated
          Error code if cannot perform operation because data truncation occurred when row was retrieved.
static int unzipError
          Error code if an unzip error encountered.
static int websphereConnectionError
          Error code if error was encountered obtaining a connection from or releasing a connection to a WebSphere connection pool.
static int wrongObjectType
          Error code if the wrong object type is used to update column/parameter.
static int zipError
          Error code if a zip error encountered.
 
Fields inherited from class java.lang.Throwable
backtrace, detailMessage, serialVersionUID
 
Constructor Summary
DataException(java.lang.String message, int errorCode)
          Constructs a new DataException with the specified message and error code.
DataException(java.lang.String message, java.sql.SQLException ex)
          Constructs a new DataException with the specified message and associates the specified SQLException with the DataException.
 
Method Summary
 int getErrorCode()
          Returns the error code associated with the exception.
 java.sql.SQLException getSQLException()
          Returns the SQLException that is associated with the DataException.
 java.lang.String toString()
          Returns a string representation of the exception.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getLocalizedMessage, getMessage, printStackTrace, printStackTrace, printStackTrace, printStackTrace0
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

fieldSQLException

protected java.sql.SQLException fieldSQLException

errCode

protected int errCode

sqlException

public static final int sqlException
Error code if an SQLException occurred. When this exception occurs, you can use the method getSQLException to get the SQLException itself, and examine its contents.

inconsistentColumnCount

public static final int inconsistentColumnCount
Error code if the number of columns in a result set does not match the number of columns specified in the StatementMetaData. If you have defined a StatementMetaData object that describes one or more columns in the result set, the number of columns described must match the number actually returned.

inconsistentColumnType

public static final int inconsistentColumnType
Error code if the SQL data types of columns in a result set do not match the SQL data types of columns specified in the StatementMetaData. If you have defined a StatementMetaData object that describes one or more columns in the result set, the SQL data types of columns described must match the SQL data types actually returned.

inconsistentColumns

public static final int inconsistentColumns
Error code if the defined columns are inconsistent with SQL statement. This error code is no longer used. It has been replaced by inconsistentColumnCount and inconsistentColumnType.

wrongObjectType

public static final int wrongObjectType
Error code if the wrong object type is used to update column/parameter. This occurs if the object you pass as the new value on setColumnValue or setParameter has a different java class than expected for the column or parameter based on the StatementMetaData.

noSQL

public static final int noSQL
Error code if no SQL Statement is specified. The SQL statement specified in StatementMetaData is either null or an empty string.

badSQLType

public static final int badSQLType
Error code if an invalid/unsupported SQL type is specified. This can occur when you use the addColumn or addParameter method to describe a column or parameter in the StatementMetaData and you specify a value for the targetSQLType parameter which is not recognized. It can also occur when you retrieve a result set returned by a query or a stored procedure, and it includes a column with a SQL data type that is not recognized. In either case, you can avoid the error by using the addColumn or addParameter method of StatementMetaData to specify a suitable recognized target SQL data type or a specific java class to use for the column or parameter.

notRegistered

public static final int notRegistered
Error code if the connection alias is not registered. An internal registry is kept of all connection aliases currently in use. This error occurs if when you disconnect, your connection alias is not found in the registry. This is an internal error that should not occur under normal conditions.

zipError

public static final int zipError
Error code if a zip error encountered. This error code is no longer used.

unzipError

public static final int unzipError
Error code if an unzip error encountered. This error code is no longer used.

decodeError

public static final int decodeError
Error code if a decode error encountered. This can occur when you use the setPassword message and request that the password be decoded before it is saved. The password could not be decoded.

websphereConnectionError

public static final int websphereConnectionError
Error code if error was encountered obtaining a connection from or releasing a connection to a WebSphere connection pool. This may occur during connect or disconnect if you are using WebSphere connection pools.

invalidConnPoolType

public static final int invalidConnPoolType
Error code if an invalid connection pool type was specified. This occurs if a value other than POOL_TYPE_WEBSPHERE or POOL_TYPE_NONE was used for the setConnectionPoolType.

badUidPwd

public static final int badUidPwd
Error code if an invalid userID or password specified. This can occur during the connect method.

noSuchParm

public static final int noSuchParm
Error code if the specified parameter is not defined. This occurs if the index or name used to identify a parameter is not defined in the StatementMetaData. This error code is not used. An ArrayIndexOutOfBoundsException is thrown instead, with a message that describes this specific condition.

noSuchColumn

public static final int noSuchColumn
Error code if the specified column is not defined. This occurs if the index or name used to identify a column is not defined in the StatementMetaData. This error code is not used. An ArrayIndexOutOfBoundsException is thrown instead, with a message that describes this specific condition.

rowNotFound

public static final int rowNotFound
Error 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.

noConnection

public static final int noConnection
Error code if there is no associated DatabaseConnection. This occurs if the operation you have requested requires a DatabaseConnection object, and no association to a DatabaseConnection object has been defined. This is an internal error that should not occur under normal conditions.

notOpen

public static final int notOpen
Error 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.

connectionClosed

public static final int connectionClosed
Error code if the JDBC connection you pass to the DatabaseConnection constructor is not open. This occurs when you attempt to create a new externally-managed DatabaseConnection object and the java.sql.Connection object you pass to the constructor is not connected to a database.

externallyManaged

public static final int externallyManaged
Error code if the connection is externally managed. A DatabaseConnection object is externally managed if it was created using the constructor that takes a java.sql.Connection parameter. The only operation currently disallowed for externally managed connections is connect.

SQLDisconnectException

public static final int SQLDisconnectException
Error code if an exception occurred during disconnect. This error code is no longer used.

badJavaClass

public static final int badJavaClass
Error code if an invalid Java Class specified. This occurs if you pass a null value for the javaClass parameter of the addColumn or addParameter method of StatementMetaData.

errorMakeField

public static final int errorMakeField
Error code if an unsupported Java class specified for column/parameter. This occurs if the value you pass for the javaClass parameter of the addColumn or addParameter method of StatementMetaData is not recognized as a valid class to contain data for a column or parameter.

notExecuted

public static final int notExecuted
Error 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.

noResults

public static final int noResults
Error code if the result set is empty. This occurs if there are no rows in the result set and you try to set the current row, perform an operation on the current row, or obtain values from a specific row via the getCacheValueAt method of SelectResult.

readOnly

public static final int readOnly
Error code if the result set is read only. This occurs if the readOnly property has been set for the statement and you attempt an operation that would change the database (such as deleteRow) or would lead to changing the database later (such as setColumnValue).

beforeCacheStart

public static final int beforeCacheStart
Error code if the specified row is before the start of the cache. This occurs if you try to set the current row to a row before the first, or to a row that has been displaced from the cache. Once a row has been displaced, you cannot position to it again without re-executing the query.

rowNotInDatabase

public static final int rowNotInDatabase
Error 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 via newRow before you have inserted it into the database. A row that is not in the database cannot be locked.

multipleTables

public static final int multipleTables
Error 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.

cloneNotSupported

public static final int cloneNotSupported
Error code if the object does not support cloning. This is an internal error that should not occur under normal conditions.

instantiationException

public static final int instantiationException
Error code if the newInstance method of a Class object fails because the Class object is abstract or an interface. This is an internal error that should not occur under normal conditions.

illegalAccess

public static final int illegalAccess
Error code if the newInstance method of a Class object fails because the class or initializer is not accessible. This is an internal error that should not occur under normal conditions.

cannotConvert

public static final int cannotConvert
Error code if a String value cannot be converted to an object of another class. This occurs if the String value passed in setColumnValueFromString or setParameterFromString cannot be converted to an object of the appropriate type for the column or parameter.

noConnectionSpec

public static final int noConnectionSpec
Error code if an error occured creating a DatabaseConnectionSpec. A DatabaseConnectionSpec is an object used internally within a DatabaseConnection to store information required to perform a connect. This error indicates a failure to create an empty DatabaseConnectionSpec for a new DatabaseConnection.

noLogonSpec

public static final int noLogonSpec
Error code if an error occured creating a DatabaseLogonSpec. A DatabaseLogonSpec is an object used internally within a DatabaseConnection to store userid and password information. This error indicates a failure to create an empty DatabaseLogonSpec for a new DatabaseConnection.

noStatementMetaData

public static final int noStatementMetaData
Error code if an error occurred creating StatementMetaData. This error can occur when attempting to create an empty default StatementMetaData object for a Statement.

noActiveConnection

public static final int noActiveConnection
Error 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.

internalError

public static final int internalError
Error code if an internal error occurred.

noGui

public static final int noGui
Error code if no GUI is available. This occurs if the promptUID property of a DatabaseConnection object is true, but when attempting to connect at runtime, the environment does not allow a graphic user interface to be used to obtain the userid and password.

noStatement

public static final int noStatement
Error code if there is no associated Statement object. This occurs if the operation you have requested requires an associated SelectStatement, ModifyStatement, or CallableStatement and there is none.

noMetaData

public static final int noMetaData
Error code if there is no associated StatementMetaData. This occurs if the operation you have requested requires an associated StatementMetaData object and there is none. This error code is not currently used.

noSuchTable

public static final int noSuchTable
Error code if the specified table is not defined. This error can occur when you use the removeTable method to remove a table from the list in a StatementMetaData object, but the table you specify is not found in the list.

duplicateColumn

public static final int duplicateColumn
Error 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.

duplicateParm

public static final int duplicateParm
Error 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.

indexTooLarge

public static final int indexTooLarge
Error code if the specified row index exceeds the allowable range. This can occur if you attempt to set the current row in a result set to a number greater than the number of rows returned. It can also occur if you specify a row number greater than the last row in the cache when calling the getCacheValueAt method of SelectResult.

maxSize

public static final int maxSize
Error code if newRow failed because result set max size limit reached. This occurs if you have set the maximumRows property of a statement to a non-zero limit. This limit not only prevents rows beyond the limit from being fetched from the database, but also from being added to the cache via newRow.

driverNotFound

public static final int driverNotFound
Error code if the JDBC driver class not found when attempting to connect.

rowChanged

public static final int rowChanged
Error 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.

lockNotSupported

public static final int lockNotSupported
Error code if method lockRow not supported for database product. The lockRow 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).

noTransactions

public static final int noTransactions
Error code if autoCommit false not supported for database product.

truncated

public static final int truncated
Error code if cannot perform operation because data truncation occurred when row was retrieved. This can occur when you attempt deleteRow or setColumnValue 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.

notSelect

public static final int notSelect
Error code if the SQL statement is not a SELECT statement. This occurs for a SelectStatement if the SQL specified in the StatementMetaData is not a SELECT statement.

notCall

public static final int notCall
Error code if the SQL statement is not a CALL statement. This occurs for a CallableStatement if the SQL specified in the StatementMetaData is not a CALL statement.

noResultSets

public static final int noResultSets
Error code if there are no result sets. This occurs if the statement has no result sets and you try to set the current result set or perform an operation on the current result set.

noValuesSet

public static final int noValuesSet
Error code if cannot insert because no values were set. This occurs when you invoke updateRow for a row added to the result set via newRow in which you have not yet set any values.

alreadyConnected

public static final int alreadyConnected
Error code if cannot connect to database because already connected.

notExecuting

public static final int notExecuting
Error code if execution of the SQL statement cannot be canceled because the statement is not executing. You may get this exception either when using the cancelExecution method to cancel a statement you are executing via the execute method or when using the cancelAction method to cancel a statement you are executing via the updateRow or deleteRow methods.

The cancelExecution and cancelAction methods must be invoked from a thread other than the one in which the statement is executing, while the statment is executing.


beforeResultCacheStart

public static final int beforeResultCacheStart
Error code if the specified result set is before the start of the cache. This occurs if you try to set the current result set to a result set before the first, or to a result set that has been displaced from the cache. Once a result set has been displaced, you cannot position to it again without re-executing the query.

resultIndexTooLarge

public static final int resultIndexTooLarge
Error code if the specified result set index exceeds the allowable range. This can occur if you attempt to set the current result set to a number greater than the number of result sets returned.

noSearchableColumns

public static final int noSearchableColumns
Error 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.

noTableDefined

public static final int noTableDefined
Error code if the bean cannot identify the correct table(s) in order to lock, update, insert, or delete a row, or to re-fetch data from it. This can occur if your StatementMetaData object does not specify at least one table and the bean fails to identify a table by parsing your query.

transactionIsolationError

public static final int transactionIsolationError
Error code if can't set transaction isolation level

cannotConvertToString

public static final int cannotConvertToString
Error code if cannot convert a column value to a String. This can happen if the cache contains a Clob or Blob value which you attempt to get using the getColumnValueToString method, and the Clob or Blob has been invalidated (by a commit, for example). It can also happen if there is a parameter with a Clob or Blob value which you attempt to get using the getParameterToString method, and the Clob or Blob has been invalidated. 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 bean will still fail. For example, the bean 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.

cannotRefreshData

public static final int cannotRefreshData
Error code if cannot refresh data in a row because the row cannot be found in the database. If you have set the validateLOBs option, an attempt is made to refresh the value of any LOB that has become invalid (due to a commit occuring, for example). A variety of conditions may prevent the 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.

copyright

private static final java.lang.String copyright
Constructor Detail

DataException

public DataException(java.lang.String message,
                     int errorCode)
Constructs a new DataException with the specified message and error code.
Parameters:
message - the exception message
errorcode - the error code

DataException

public DataException(java.lang.String message,
                     java.sql.SQLException ex)
Constructs a new DataException with the specified message and associates the specified SQLException with the DataException.
Parameters:
message - the exception message
ex - the associated SQLException
Method Detail

getErrorCode

public int getErrorCode()
Returns the error code associated with the exception. The error codes are defined as fields in DataException.
Returns:
the error code.

getSQLException

public java.sql.SQLException getSQLException()
Returns the SQLException that is associated with the DataException. If the error code for this exception is not sqlException, this method returns a null.
Returns:
the SQLException

toString

public java.lang.String toString()
Returns a string representation of the exception. If the error code is sqlException, then the message associated with the SQLException is included.
Overrides:
toString in class java.lang.Throwable
Returns:
java.lang.String