org.apache.derby.impl.jdbc
Class SQLExceptionFactory40
java.lang.Object
org.apache.derby.impl.jdbc.SQLExceptionFactory
org.apache.derby.impl.jdbc.SQLExceptionFactory40
- All Implemented Interfaces:
- ExceptionFactory
public class SQLExceptionFactory40
- extends SQLExceptionFactory
SQLExceptionFactory40 overwrites getSQLException method
to return SQLException or one of its sub class
|
Method Summary |
java.sql.SQLException |
getSQLException(java.lang.String message,
java.lang.String messageId,
java.sql.SQLException next,
int severity,
java.lang.Throwable t,
java.lang.Object[] args)
overwrites super class method to create JDBC4 exceptions
SQLSTATE CLASS (prefix) Exception
0A java.sql.SQLFeatureNotSupportedException
08 java.sql.SQLNonTransientConnectionException
22 java.sql.SQLDataException
28 java.sql.SQLInvalidAuthorizationSpecException
40 java.sql.SQLTransactionRollbackException
42 java.sql.SQLSyntaxErrorException
Note the following divergence from JDBC3 behavior: When running
a JDBC3 client, we return EmbedSQLException. |
private java.sql.SQLException |
wrapArgsForTransportAcrossDRDA(java.lang.String message,
java.lang.String messageId,
java.sql.SQLException next,
int severity,
java.lang.Throwable t,
java.lang.Object[] args)
The following method helps handle DERBY-1178. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SQLExceptionFactory40
public SQLExceptionFactory40()
getSQLException
public java.sql.SQLException getSQLException(java.lang.String message,
java.lang.String messageId,
java.sql.SQLException next,
int severity,
java.lang.Throwable t,
java.lang.Object[] args)
- overwrites super class method to create JDBC4 exceptions
SQLSTATE CLASS (prefix) Exception
0A java.sql.SQLFeatureNotSupportedException
08 java.sql.SQLNonTransientConnectionException
22 java.sql.SQLDataException
28 java.sql.SQLInvalidAuthorizationSpecException
40 java.sql.SQLTransactionRollbackException
42 java.sql.SQLSyntaxErrorException
Note the following divergence from JDBC3 behavior: When running
a JDBC3 client, we return EmbedSQLException. That exception class
overrides Throwable.toString() and strips off the Throwable's class name.
In contrast, the following JDBC4 implementation returns
subclasses of java.sql.Exception. These subclasses inherit the behavior
of Throwable.toString(). That is, their toString() output includes
their class name. This will break code which relies on the
stripping behavior of EmbedSQLSxception.toString().
- Specified by:
getSQLException in interface ExceptionFactory- Overrides:
getSQLException in class SQLExceptionFactory
- Parameters:
message - the exception messagemessageId - the message idnext - the next SQLExceptionseverity - the severity of the exceptiont - the cause of the exceptionargs - the message arguments
- Returns:
- an SQLException
wrapArgsForTransportAcrossDRDA
private java.sql.SQLException wrapArgsForTransportAcrossDRDA(java.lang.String message,
java.lang.String messageId,
java.sql.SQLException next,
int severity,
java.lang.Throwable t,
java.lang.Object[] args)
The following method helps handle DERBY-1178. The problem is that we may
need to serialize our final SQLException across the DRDA network layer.
That serialization involves some clever encoding of the Derby messageID and
arguments. Unfortunately, once we create one of the
JDBC4-specific subclasses of SQLException, we lose the messageID and
args. This method creates a dummy EmbedSQLException which preserves that
information. We return the dummy exception.
Apache Derby V10.10 Internals - Copyright © 2004,2013 The Apache Software Foundation. All Rights Reserved.