Top Description Constructors Methods
org.apache.derby.impl.jdbc

public Class SQLExceptionFactory

extends ExceptionFactory
Class Inheritance
Imports
java.sql.SQLDataException, .SQLException, .SQLFeatureNotSupportedException, .SQLIntegrityConstraintViolationException, .SQLInvalidAuthorizationSpecException, .SQLNonTransientConnectionException, .SQLSyntaxErrorException, .SQLTimeoutException, .SQLTransactionRollbackException, org.apache.derby.shared.common.error.StandardException, .ExceptionFactory, .DerbySQLIntegrityConstraintViolationException, org.apache.derby.shared.common.i18n.MessageService, org.apache.derby.shared.common.reference.SQLState

Class to create SQLException

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public SQLException
getSQLException(String
the exception message
message
,
String
the message id
messageId
,
SQLException
the next SQLException
next
,
int
the severity of the exception
severity
,
Throwable
the cause of the exception
t
,
Object...
the message arguments
args
)

Implements abstract org.apache.derby.shared.common.error.ExceptionFactory.getSQLException.

method to construct SQLException version specific drivers can overload this method to create version specific exceptions

This implementation creates JDBC 4 exceptions.

public final SQLException
getSQLException(String
the message id
messageId
,
SQLException
the next SQLException
next
,
Throwable
the cause of the exception
cause
,
Object...
the message arguments
args
)

Implements abstract org.apache.derby.shared.common.error.ExceptionFactory.getSQLException.

Construct an SQLException whose message and severity are derived from the message id.

private StandardException
wrapArgsForTransportAcrossDRDA(String messageId, Throwable cause, Object[] args)

The following method helps handle DERBY-1178.

Inherited from org.apache.derby.shared.common.error.ExceptionFactory:
getInstance

Constructor Detail

SQLExceptionFactoryback to summary
public SQLExceptionFactory()

Method Detail

getSQLExceptionback to summary
public SQLException getSQLException(String message, String messageId, SQLException next, int severity, Throwable t, Object... args)

Implements abstract org.apache.derby.shared.common.error.ExceptionFactory.getSQLException.

method to construct SQLException version specific drivers can overload this method to create version specific exceptions

This implementation creates JDBC 4 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
Parameters
message:String

Doc from org.apache.derby.shared.common.error.ExceptionFactory.getSQLException.

the exception message

messageId:String

Doc from org.apache.derby.shared.common.error.ExceptionFactory.getSQLException.

the message id

next:SQLException

Doc from org.apache.derby.shared.common.error.ExceptionFactory.getSQLException.

the next SQLException

severity:int

Doc from org.apache.derby.shared.common.error.ExceptionFactory.getSQLException.

the severity of the exception

t:Throwable

Doc from org.apache.derby.shared.common.error.ExceptionFactory.getSQLException.

the cause of the exception

args:Object[]

Doc from org.apache.derby.shared.common.error.ExceptionFactory.getSQLException.

the message arguments

Returns:SQLException

Doc from org.apache.derby.shared.common.error.ExceptionFactory.getSQLException.

an SQLException

Annotations
@Override
getSQLExceptionback to summary
public final SQLException getSQLException(String messageId, SQLException next, Throwable cause, Object... args)

Implements abstract org.apache.derby.shared.common.error.ExceptionFactory.getSQLException.

Construct an SQLException whose message and severity are derived from the message id.

Parameters
messageId:String

Doc from org.apache.derby.shared.common.error.ExceptionFactory.getSQLException.

the message id

next:SQLException

Doc from org.apache.derby.shared.common.error.ExceptionFactory.getSQLException.

the next SQLException

cause:Throwable

Doc from org.apache.derby.shared.common.error.ExceptionFactory.getSQLException.

the cause of the exception

args:Object[]

Doc from org.apache.derby.shared.common.error.ExceptionFactory.getSQLException.

the message arguments

Returns:SQLException

Doc from org.apache.derby.shared.common.error.ExceptionFactory.getSQLException.

an SQLException

Annotations
@Override
wrapArgsForTransportAcrossDRDAback to summary
private StandardException wrapArgsForTransportAcrossDRDA(String messageId, Throwable cause, 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 StandardException which preserves that information, unless the cause is already a StandardException which contains the necessary information for serializing the exception.