public class SqlException extends java.lang.Exception implements Diagnosable
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
batchPositionLabel_ |
protected java.lang.String |
cachedMessage_ |
protected java.lang.String |
causeString_ |
static java.lang.String |
CLIENT_MESSAGE_RESOURCE_NAME |
protected static int |
DEFAULT_ERRCODE |
protected int |
errorcode_ |
protected static SQLExceptionFactory |
exceptionFactory |
protected java.lang.String |
message_ |
private int |
messageNumber_
Tells which of the messages in the SQLCA this exception refers to
(counting from 0).
|
private static MessageUtil |
msgutil_
The message utility instance we use to find messages
It's primed with the name of the client message bundle so that
it knows to look there if the message isn't found in the
shared message bundle.
|
protected SqlException |
nextException_ |
protected Sqlca |
sqlca_ |
protected java.lang.String |
sqlstate_ |
protected java.lang.Throwable |
throwable_ |
protected java.sql.SQLException |
wrappedException_
The wrapped SQLException, if one exists
|
Modifier | Constructor and Description |
---|---|
|
SqlException(LogWriter logwriter,
ClientMessageId msgid) |
|
SqlException(LogWriter logwriter,
ClientMessageId msgid,
java.lang.Object arg1) |
|
SqlException(LogWriter logwriter,
ClientMessageId msgid,
java.lang.Object[] args) |
|
SqlException(LogWriter logWriter,
ClientMessageId msgid,
java.lang.Object[] args,
SqlCode sqlcode) |
|
SqlException(LogWriter logWriter,
ClientMessageId msgid,
java.lang.Object[] args,
SqlCode sqlcode,
java.lang.Throwable t) |
|
SqlException(LogWriter logwriter,
ClientMessageId msgid,
java.lang.Object[] args,
java.lang.Throwable cause)
Create a SqlException.
|
|
SqlException(LogWriter logwriter,
ClientMessageId msgid,
java.lang.Object arg1,
java.lang.Object arg2) |
|
SqlException(LogWriter logwriter,
ClientMessageId msgid,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3) |
|
SqlException(LogWriter logWriter,
ClientMessageId msgid,
java.lang.Object arg1,
java.lang.Object arg2,
SqlCode sqlcode) |
|
SqlException(LogWriter logwriter,
ClientMessageId msgid,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Throwable cause) |
|
SqlException(LogWriter logWriter,
ClientMessageId msgid,
java.lang.Object arg1,
SqlCode sqlcode) |
|
SqlException(LogWriter logwriter,
ClientMessageId msgid,
java.lang.Object arg1,
java.lang.Throwable cause) |
|
SqlException(LogWriter logWriter,
ClientMessageId msgid,
SqlCode sqlcode) |
|
SqlException(LogWriter logwriter,
ClientMessageId msgid,
java.lang.Throwable cause) |
|
SqlException(LogWriter logWriter,
Sqlca sqlca)
Create an exception for an engine generated error.
|
protected |
SqlException(LogWriter logWriter,
java.lang.String reason,
java.lang.String sqlState,
int errorCode) |
protected |
SqlException(LogWriter logWriter,
java.lang.Throwable throwable,
java.lang.String reason,
java.lang.String sqlState,
int errorCode) |
private |
SqlException(Sqlca sqlca,
int number,
boolean chain)
Create one of the exceptions in an exception chain generated by the
engine.
|
|
SqlException(java.sql.SQLException wrapme)
Wrap a SQLException in a SqlException.
|
Modifier and Type | Method and Description |
---|---|
(package private) SqlException |
copyAsUnchainedSQLException(LogWriter logWriter) |
int |
getErrorCode() |
java.lang.String |
getMessage() |
static MessageUtil |
getMessageUtil()
This routine provides singleton access to an instance of MessageUtil
that is constructed for client messages.
|
SqlException |
getNextException() |
Sqlca |
getSqlca() |
java.sql.SQLException |
getSQLException()
Convert this SqlException into a java.sql.SQLException
|
java.lang.String |
getSQLState() |
static SqlException |
javaException(LogWriter logWriter,
java.lang.Throwable e)
Helper method to construct an exception which basically says that
we encountered an underlying Java exception
|
void |
printTrace(java.io.PrintWriter printWriter,
java.lang.String header) |
(package private) void |
setBatchPositionLabel(int index) |
static void |
setExceptionFactory(SQLExceptionFactory factory)
Sets the exceptionFactory to be used for creating SQLException
|
void |
setNextException(SqlException nextException) |
void |
setNextException(java.sql.SQLException nextException) |
private void |
setThrowable(java.lang.Throwable throwable)
Set the cause of this exception based on its type.
|
protected static final int DEFAULT_ERRCODE
protected transient Sqlca sqlca_
private transient int messageNumber_
protected java.lang.String message_
protected java.lang.String cachedMessage_
private java.lang.String batchPositionLabel_
protected java.lang.String sqlstate_
protected int errorcode_
protected java.lang.String causeString_
protected SqlException nextException_
protected java.lang.Throwable throwable_
public static final java.lang.String CLIENT_MESSAGE_RESOURCE_NAME
protected static SQLExceptionFactory exceptionFactory
private static MessageUtil msgutil_
protected java.sql.SQLException wrappedException_
public SqlException(LogWriter logwriter, ClientMessageId msgid, java.lang.Object[] args, java.lang.Throwable cause)
logwriter
- Can be null, but if provided, it is used to log this exceptionmsgid
- The message id for this message. ClientMessageId is a simple type-safe
wrapper for org.apache.derby.shared.common.reference.SQLState message id
strings.args
- The set of substitution arguments for the message. The Java message
formatter will substitute these arguments into the internationalized
strings using the substitution ({0}, {1}, etc.) markers in the string.
Any object can be passed, but if you want it to be readable, make sure
toString() for the object returns something useful.cause
- Can be null. Indicates the cause of this exception. If this is
an instance of SqlException or java.sql.SQLException then the exception
is chained into the nextException chain. Otherwise it is chained
using initCause(). On JDK 1.3, since initCause() does not exist,
a non-SQL exception can not be chained. Instead, the exception class
and message text is appended to the message for this exception.public SqlException(LogWriter logWriter, ClientMessageId msgid, java.lang.Object[] args, SqlCode sqlcode, java.lang.Throwable t)
public SqlException(LogWriter logWriter, ClientMessageId msgid, java.lang.Object[] args, SqlCode sqlcode)
public SqlException(LogWriter logWriter, ClientMessageId msgid, SqlCode sqlcode)
public SqlException(LogWriter logWriter, ClientMessageId msgid, java.lang.Object arg1, SqlCode sqlcode)
public SqlException(LogWriter logWriter, ClientMessageId msgid, java.lang.Object arg1, java.lang.Object arg2, SqlCode sqlcode)
public SqlException(LogWriter logwriter, ClientMessageId msgid, java.lang.Throwable cause)
public SqlException(LogWriter logwriter, ClientMessageId msgid, java.lang.Object[] args)
public SqlException(LogWriter logwriter, ClientMessageId msgid)
public SqlException(LogWriter logwriter, ClientMessageId msgid, java.lang.Object arg1)
public SqlException(LogWriter logwriter, ClientMessageId msgid, java.lang.Object arg1, java.lang.Throwable cause)
public SqlException(LogWriter logwriter, ClientMessageId msgid, java.lang.Object arg1, java.lang.Object arg2, java.lang.Throwable cause)
public SqlException(LogWriter logwriter, ClientMessageId msgid, java.lang.Object arg1, java.lang.Object arg2)
public SqlException(LogWriter logwriter, ClientMessageId msgid, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)
public SqlException(LogWriter logWriter, Sqlca sqlca)
logWriter
- object used for tracingsqlca
- the SQLCA sent from the serverprivate SqlException(Sqlca sqlca, int number, boolean chain)
chain
is true
.sqlca
- the SQLCA sent from the servernumber
- the message number for this exception (counting from 0)chain
- if true
, generate the rest of the exception
chain recursively and link it to this exceptionprotected SqlException(LogWriter logWriter, java.lang.String reason, java.lang.String sqlState, int errorCode)
protected SqlException(LogWriter logWriter, java.lang.Throwable throwable, java.lang.String reason, java.lang.String sqlState, int errorCode)
public SqlException(java.sql.SQLException wrapme)
public static MessageUtil getMessageUtil()
private void setThrowable(java.lang.Throwable throwable)
SQLException
s and SqlException
s are
linked with setNextException()
and initCause()
.
All other exception types are linked with initCause()
.public java.sql.SQLException getSQLException()
void setBatchPositionLabel(int index)
public Sqlca getSqlca()
getSqlca
in interface Diagnosable
public java.lang.String getMessage()
getMessage
in class java.lang.Throwable
public java.lang.String getSQLState()
public int getErrorCode()
public SqlException getNextException()
public void setNextException(SqlException nextException)
public void setNextException(java.sql.SQLException nextException)
public void printTrace(java.io.PrintWriter printWriter, java.lang.String header)
printTrace
in interface Diagnosable
public static SqlException javaException(LogWriter logWriter, java.lang.Throwable e)
SqlException copyAsUnchainedSQLException(LogWriter logWriter)
public static void setExceptionFactory(SQLExceptionFactory factory)
factory
- SQLExceptionFactoryApache Derby V10.10 Internals - Copyright © 2004,2013 The Apache Software Foundation. All Rights Reserved.