IBM DB2 Information Integrator
Java API Reference
for Developing Wrappers

com.ibm.db2.wrapper
Class WrapperException

java.lang.Object
  extended byjava.lang.Throwable
      extended byjava.lang.Exception
          extended bycom.ibm.db2.wrapper.WrapperException
All Implemented Interfaces:
java.io.Serializable

public class WrapperException
extends java.lang.Exception

The WrapperException class is the Exception subclass that is used by the Java API to report exceptions.

Usage:
This class is instantiated by the wrapper to report an exception that contains either a string message or an SQL error code, caller function name and tokens that map to a DB2 Information Integrator error message.

Since:
IBM DB2 Information Integrator Version 8.2
See Also:
Serialized Form

Constructor Summary
WrapperException(int errorCode, java.lang.String functionName, java.lang.String[] tokens)
          Construct an exception object that reports a DB2 Information Integrator error by its SQL code, caller function name, and tokens.
WrapperException(java.lang.String message)
          Construct a new exception object with the specified message.
 
Method Summary
 int getAndResetErrorCode()
          Retrieve and reset the SQL error code to report a DB2 Information Integrator error.
 java.lang.String getAndResetFunctionName()
          Retrieve and reset the caller function name that reports a DB2 Information Integrator error.
 java.lang.String[] getAndResetTokens()
          Retrieve and reset the substitution tokens that are used to report a DB2 Information Integrator error.
 int getErrorCode()
          Retrieve the SQL error code to report a DB2 Information Integrator error.
 java.lang.String getFunctionName()
          Retrieve the caller function name that reports a DB2 Information Integrator error.
 java.lang.String getMessage()
          Retrieve the error message string of this exception object.
static java.lang.String getStackTrace(java.lang.Throwable throwable)
          Save the stack trace of the exception into a string.
 java.lang.String[] getTokens()
          Retrieve the substitution tokens that are used to report a DB2 Information Integrator error.
 void setErrorCode(int errorCode)
          Set the SQL error code for reporting a DB2 Information Integrator error.
 void setFunctionName(java.lang.String functionName)
          Set the caller function name for reporting a DB2 Information Integrator error.
 void setTokens(java.lang.String[] tokens)
          Set the substitution tokens that are used for reporting a DB2 Information Integrator error.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WrapperException

public WrapperException(int errorCode,
                        java.lang.String functionName,
                        java.lang.String[] tokens)
Construct an exception object that reports a DB2 Information Integrator error by its SQL code, caller function name, and tokens. Each valid SQL code identifies an error message. The error message might contain placeholders that are replaced with the given tokens before the message is reported to the user.

Parameters:
errorCode - The predefined SQL code of the error that is reported.
functionName - The name of the function that reports the error. The string value cannot be greater than five characters. The client program can access this string value through the SQLERRP field of the SQLCA. The string value is in uppercase letters with a prefix of SQL.
tokens - The substitution tokens for the message.
Since:
IBM DB2 Information Integrator Version 8.2

WrapperException

public WrapperException(java.lang.String message)
Construct a new exception object with the specified message. If an error code is not specified in the exception that is thrown to DB2 Information Integrator, an SQL0901 error is reported and the exception message replaces the SQL0901 error message placeholder.

Parameters:
message - The message that describes the exception.
Since:
IBM DB2 Information Integrator Version 8.2
See Also:
Exception
Method Detail

getAndResetErrorCode

public final int getAndResetErrorCode()
Retrieve and reset the SQL error code to report a DB2 Information Integrator error. Each DB2 Information Integrator error is identified by a SQL error code.

Returns:
The predefined SQL code of the error that is reported.
Since:
IBM DB2 Information Integrator Version 8.2

getAndResetFunctionName

public final java.lang.String getAndResetFunctionName()
Retrieve and reset the caller function name that reports a DB2 Information Integrator error. The caller function name is reported with a DB2 Information Integrator error in the SQLERRP field of the SQLCA structure.

Returns:
The name of the function that reports the error. The string value cannot be greater than five characters. The client program can access this string value through the SQLERRP field of the SQLCA. The string value is in uppercase letters with a prefix of SQL.
Since:
IBM DB2 Information Integrator Version 8.2

getAndResetTokens

public final java.lang.String[] getAndResetTokens()
Retrieve and reset the substitution tokens that are used to report a DB2 Information Integrator error. The substitution tokens replace the placeholders in the DB2 Information Integrator error message.

Returns:
The substitution tokens that are used in the error message when a DB2 Information Integrator error is reported.
Since:
IBM DB2 Information Integrator Version 8.2

getErrorCode

public final int getErrorCode()
Retrieve the SQL error code to report a DB2 Information Integrator error. Each DB2 Information Integrator error is identified by a SQL error code.

Returns:
The predefined SQL code of the error that is reported.
Since:
IBM DB2 Information Integrator Version 8.2

getFunctionName

public final java.lang.String getFunctionName()
Retrieve the caller function name that reports a DB2 Information Integrator error. The caller function name is reported with a DB2 Information Integrator error in the SQLERRP field of the SQLCA structure.

Returns:
The name of the function that reports the error. The string value cannot be greater than five characters. The client program can access this string value through the SQLERRP field of the SQLCA. The string value is in uppercase letters with a prefix of SQL.
Since:
IBM DB2 Information Integrator Version 8.2

getMessage

public java.lang.String getMessage()
Retrieve the error message string of this exception object.

Returns:
If the WraperException object was created with an error message string, the error message string of this WrapperException object. If the WraperException object was created with an SQL error code, a string showing the SQL error code, the caller function name and the set of tokens.
Since:
IBM DB2 Information Integrator Version 8.2

getStackTrace

public static java.lang.String getStackTrace(java.lang.Throwable throwable)
Save the stack trace of the exception into a string.

Parameters:
throwable - The throwable object that the stack trace is extracted from.
Returns:
The string that contains the stack trace information.
Since:
IBM DB2 Information Integrator Version 8.2
See Also:
Throwable

getTokens

public final java.lang.String[] getTokens()
Retrieve the substitution tokens that are used to report a DB2 Information Integrator error. The substitution tokens replace the placeholders in the DB2 Information Integrator error message.

Returns:
The substitution tokens that are used in the error message when a DB2 Information Integrator error is reported.
Since:
IBM DB2 Information Integrator Version 8.2

setErrorCode

public final void setErrorCode(int errorCode)
Set the SQL error code for reporting a DB2 Information Integrator error. Each DB2 Information Integrator error is identified by a SQL error code.

Parameters:
errorCode - The predefined SQL code of the error that is reported.
Since:
IBM DB2 Information Integrator Version 8.2

setFunctionName

public final void setFunctionName(java.lang.String functionName)
Set the caller function name for reporting a DB2 Information Integrator error. The caller function name is reported with a DB2 Information Integrator error in the SQLERRP field of the SQLCA structure.

Parameters:
functionName - The name of the function that reports the error. The string value cannot be greater than five characters. The client program can access this string value through the SQLERRP field of the SQLCA. The string value is in uppercase letters with a prefix of SQL.
Since:
IBM DB2 Information Integrator Version 8.2

setTokens

public final void setTokens(java.lang.String[] tokens)
Set the substitution tokens that are used for reporting a DB2 Information Integrator error. The substitution tokens replace the placeholders in the DB2 Information Integrator error message.

Parameters:
tokens - The substitution tokens that are used in the error message when a DB2 Information Integrator error is reported.
Since:
IBM DB2 Information Integrator Version 8.2

IBM DB2 Information Integrator
Java API Reference
for Developing Wrappers

(C)Copyright IBM Corp. 2002. All rights reserved.

Links on this page are made available for your convenience and may take you to non-IBM sites. IBM does not warrant any sample code provided on these sites.