Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.mysql.jdbc
Class SQLError

    java.lang.Object
      com.mysql.jdbc.SQLError

    public class SQLError

extends java.lang.Object

SQLError is a utility class that maps MySQL error codes to X/Open error codes as is required by the JDBC spec.

Field Summary
`(package private) static int` | `ER_WARNING_NOT_COMPLETE_ROLLBACK`
`static java.lang.String` | `SQL_STATE_BASE_TABLE_NOT_FOUND`
`static java.lang.String` | `SQL_STATE_BASE_TABLE_OR_VIEW_ALREADY_EXISTS`
`static java.lang.String` | `SQL_STATE_BASE_TABLE_OR_VIEW_NOT_FOUND`
`static java.lang.String` | `SQL_STATE_COLUMN_ALREADY_EXISTS`
`static java.lang.String` | `SQL_STATE_COLUMN_NOT_FOUND`
`static java.lang.String` | `SQL_STATE_COMMUNICATION_LINK_FAILURE`
`static java.lang.String` | `SQL_STATE_CONNECTION_FAIL_DURING_TX`
`static java.lang.String` | `SQL_STATE_CONNECTION_IN_USE`
`static java.lang.String` | `SQL_STATE_CONNECTION_NOT_OPEN`
`static java.lang.String` | `SQL_STATE_CONNECTION_REJECTED`
`static java.lang.String` | `SQL_STATE_DATE_TRUNCATED`
`static java.lang.String` | `SQL_STATE_DATETIME_FIELD_OVERFLOW`
`static java.lang.String` | `SQL_STATE_DEADLOCK`
`static java.lang.String` | `SQL_STATE_DISCONNECT_ERROR`
`static java.lang.String` | `SQL_STATE_DIVISION_BY_ZERO`
`static java.lang.String` | `SQL_STATE_DRIVER_NOT_CAPABLE`
`static java.lang.String` | `SQL_STATE_ERROR_IN_ROW`
`static java.lang.String` | `SQL_STATE_GENERAL_ERROR`
`static java.lang.String` | `SQL_STATE_ILLEGAL_ARGUMENT`
`static java.lang.String` | `SQL_STATE_INDEX_ALREADY_EXISTS`
`static java.lang.String` | `SQL_STATE_INDEX_NOT_FOUND`
`static java.lang.String` | `SQL_STATE_INSERT_VALUE_LIST_NO_MATCH_COL_LIST`
`static java.lang.String` | `SQL_STATE_INVALID_AUTH_SPEC`
`static java.lang.String` | `SQL_STATE_INVALID_CHARACTER_VALUE_FOR_CAST`
`static java.lang.String` | `SQL_STATE_INVALID_COLUMN_NUMBER`
`static java.lang.String` | `SQL_STATE_INVALID_CONNECTION_ATTRIBUTE`
`static java.lang.String` | `SQL_STATE_INVALID_TRANSACTION_TERMINATION`
`static java.lang.String` | `SQL_STATE_MEMORY_ALLOCATION_FAILURE`
`static java.lang.String` | `SQL_STATE_MORE_THAN_ONE_ROW_UPDATED_OR_DELETED`
`static java.lang.String` | `SQL_STATE_NO_DEFAULT_FOR_COLUMN`
`static java.lang.String` | `SQL_STATE_NO_ROWS_UPDATED_OR_DELETED`
`static java.lang.String` | `SQL_STATE_NUMERIC_VALUE_OUT_OF_RANGE`
`static java.lang.String` | `SQL_STATE_PRIVILEGE_NOT_REVOKED`
`static java.lang.String` | `SQL_STATE_SYNTAX_ERROR`
`static java.lang.String` | `SQL_STATE_TIMEOUT_EXPIRED`
`static java.lang.String` | `SQL_STATE_TRANSACTION_RESOLUTION_UNKNOWN`
`static java.lang.String` | `SQL_STATE_UNABLE_TO_CONNECT_TO_DATASOURCE`
`static java.lang.String` | `SQL_STATE_WRONG_NO_OF_PARAMETERS`

Constructor Summary
`SQLError()`

Method Summary
`(package private) static java.sql.SQLWarning` | `convertShowWarningsToSQLWarnings(Connection connection)` Turns output of 'SHOW WARNINGS' into JDBC SQLWarning instances.
`(package private) static java.sql.SQLWarning` | `convertShowWarningsToSQLWarnings(Connection connection, int warningCountIfKnown, boolean forTruncationOnly)` Turns output of 'SHOW WARNINGS' into JDBC SQLWarning instances.
`static java.sql.SQLException` | `createCommunicationsException(ConnectionImpl conn, long lastPacketSentTimeMs, long lastPacketReceivedTimeMs, java.lang.Exception underlyingException)`
`static java.lang.String` | `createLinkFailureMessageBasedOnHeuristics(ConnectionImpl conn, long lastPacketSentTimeMs, long lastPacketReceivedTimeMs, java.lang.Exception underlyingException, boolean streamingResultSetInPlay)` Creates a communications link failure message to be used in CommunicationsException that (hopefully) has some better information and suggestions based on heuristics.
`static java.sql.SQLException` | `createSQLException(java.lang.String message)`
`static java.sql.SQLException` | `createSQLException(java.lang.String message, java.lang.String sqlState)`
`static java.sql.SQLException` | `createSQLException(java.lang.String message, java.lang.String sqlState, int vendorErrorCode)`
`static java.sql.SQLException` | `createSQLException(java.lang.String message, java.lang.String sqlState, int vendorErrorCode, boolean isTransient)`
`static java.sql.SQLException` | `createSQLException(java.lang.String message, java.lang.String sqlState, java.lang.Throwable cause)`
`static void` | `dumpSqlStatesMappingsAsXml()`
`(package private) static java.lang.String` | `get(java.lang.String stateCode)`
`(package private) static java.lang.String` | `mysqlToSqlState(int errno, boolean useSql92States)` Map MySQL error codes to X/Open or SQL-92 error codes
`static java.sql.SQLException` | `notImplemented()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### ER_WARNING_NOT_COMPLETE_ROLLBACK

    static final int ER_WARNING_NOT_COMPLETE_ROLLBACK

See Also:
  Constant Field Values

### SQL_STATE_BASE_TABLE_NOT_FOUND

    public static final java.lang.String SQL_STATE_BASE_TABLE_NOT_FOUND

See Also:
  Constant Field Values

### SQL_STATE_BASE_TABLE_OR_VIEW_ALREADY_EXISTS

    public static final java.lang.String SQL_STATE_BASE_TABLE_OR_VIEW_ALREADY_EXISTS

See Also:
  Constant Field Values

### SQL_STATE_BASE_TABLE_OR_VIEW_NOT_FOUND

    public static final java.lang.String SQL_STATE_BASE_TABLE_OR_VIEW_NOT_FOUND

See Also:
  Constant Field Values

### SQL_STATE_COLUMN_ALREADY_EXISTS

    public static final java.lang.String SQL_STATE_COLUMN_ALREADY_EXISTS

See Also:
  Constant Field Values

### SQL_STATE_COLUMN_NOT_FOUND

    public static final java.lang.String SQL_STATE_COLUMN_NOT_FOUND

See Also:
  Constant Field Values

### SQL_STATE_COMMUNICATION_LINK_FAILURE

    public static final java.lang.String SQL_STATE_COMMUNICATION_LINK_FAILURE

See Also:
  Constant Field Values

### SQL_STATE_CONNECTION_FAIL_DURING_TX

    public static final java.lang.String SQL_STATE_CONNECTION_FAIL_DURING_TX

See Also:
  Constant Field Values

### SQL_STATE_CONNECTION_IN_USE

    public static final java.lang.String SQL_STATE_CONNECTION_IN_USE

See Also:
  Constant Field Values

### SQL_STATE_CONNECTION_NOT_OPEN

    public static final java.lang.String SQL_STATE_CONNECTION_NOT_OPEN

See Also:
  Constant Field Values

### SQL_STATE_CONNECTION_REJECTED

    public static final java.lang.String SQL_STATE_CONNECTION_REJECTED

See Also:
  Constant Field Values

### SQL_STATE_DATE_TRUNCATED

    public static final java.lang.String SQL_STATE_DATE_TRUNCATED

See Also:
  Constant Field Values

### SQL_STATE_DATETIME_FIELD_OVERFLOW

    public static final java.lang.String SQL_STATE_DATETIME_FIELD_OVERFLOW

See Also:
  Constant Field Values

### SQL_STATE_DEADLOCK

    public static final java.lang.String SQL_STATE_DEADLOCK

See Also:
  Constant Field Values

### SQL_STATE_DISCONNECT_ERROR

    public static final java.lang.String SQL_STATE_DISCONNECT_ERROR

See Also:
  Constant Field Values

### SQL_STATE_DIVISION_BY_ZERO

    public static final java.lang.String SQL_STATE_DIVISION_BY_ZERO

See Also:
  Constant Field Values

### SQL_STATE_DRIVER_NOT_CAPABLE

    public static final java.lang.String SQL_STATE_DRIVER_NOT_CAPABLE

See Also:
  Constant Field Values

### SQL_STATE_ERROR_IN_ROW

    public static final java.lang.String SQL_STATE_ERROR_IN_ROW

See Also:
  Constant Field Values

### SQL_STATE_GENERAL_ERROR

    public static final java.lang.String SQL_STATE_GENERAL_ERROR

See Also:
  Constant Field Values

### SQL_STATE_ILLEGAL_ARGUMENT

    public static final java.lang.String SQL_STATE_ILLEGAL_ARGUMENT

See Also:
  Constant Field Values

### SQL_STATE_INDEX_ALREADY_EXISTS

    public static final java.lang.String SQL_STATE_INDEX_ALREADY_EXISTS

See Also:
  Constant Field Values

### SQL_STATE_INDEX_NOT_FOUND

    public static final java.lang.String SQL_STATE_INDEX_NOT_FOUND

See Also:
  Constant Field Values

### SQL_STATE_INSERT_VALUE_LIST_NO_MATCH_COL_LIST

    public static final java.lang.String SQL_STATE_INSERT_VALUE_LIST_NO_MATCH_COL_LIST

See Also:
  Constant Field Values

### SQL_STATE_INVALID_AUTH_SPEC

    public static final java.lang.String SQL_STATE_INVALID_AUTH_SPEC

See Also:
  Constant Field Values

### SQL_STATE_INVALID_CHARACTER_VALUE_FOR_CAST

    public static final java.lang.String SQL_STATE_INVALID_CHARACTER_VALUE_FOR_CAST

See Also:
  Constant Field Values

### SQL_STATE_INVALID_COLUMN_NUMBER

    public static final java.lang.String SQL_STATE_INVALID_COLUMN_NUMBER

See Also:
  Constant Field Values

### SQL_STATE_INVALID_CONNECTION_ATTRIBUTE

    public static final java.lang.String SQL_STATE_INVALID_CONNECTION_ATTRIBUTE

See Also:
  Constant Field Values

### SQL_STATE_MEMORY_ALLOCATION_FAILURE

    public static final java.lang.String SQL_STATE_MEMORY_ALLOCATION_FAILURE

See Also:
  Constant Field Values

### SQL_STATE_MORE_THAN_ONE_ROW_UPDATED_OR_DELETED

    public static final java.lang.String SQL_STATE_MORE_THAN_ONE_ROW_UPDATED_OR_DELETED

See Also:
  Constant Field Values

### SQL_STATE_NO_DEFAULT_FOR_COLUMN

    public static final java.lang.String SQL_STATE_NO_DEFAULT_FOR_COLUMN

See Also:
  Constant Field Values

### SQL_STATE_NO_ROWS_UPDATED_OR_DELETED

    public static final java.lang.String SQL_STATE_NO_ROWS_UPDATED_OR_DELETED

See Also:
  Constant Field Values

### SQL_STATE_NUMERIC_VALUE_OUT_OF_RANGE

    public static final java.lang.String SQL_STATE_NUMERIC_VALUE_OUT_OF_RANGE

See Also:
  Constant Field Values

### SQL_STATE_PRIVILEGE_NOT_REVOKED

    public static final java.lang.String SQL_STATE_PRIVILEGE_NOT_REVOKED

See Also:
  Constant Field Values

### SQL_STATE_SYNTAX_ERROR

    public static final java.lang.String SQL_STATE_SYNTAX_ERROR

See Also:
  Constant Field Values

### SQL_STATE_TIMEOUT_EXPIRED

    public static final java.lang.String SQL_STATE_TIMEOUT_EXPIRED

See Also:
  Constant Field Values

### SQL_STATE_TRANSACTION_RESOLUTION_UNKNOWN

    public static final java.lang.String SQL_STATE_TRANSACTION_RESOLUTION_UNKNOWN

See Also:
  Constant Field Values

### SQL_STATE_UNABLE_TO_CONNECT_TO_DATASOURCE

    public static final java.lang.String SQL_STATE_UNABLE_TO_CONNECT_TO_DATASOURCE

See Also:
  Constant Field Values

### SQL_STATE_WRONG_NO_OF_PARAMETERS

    public static final java.lang.String SQL_STATE_WRONG_NO_OF_PARAMETERS

See Also:
  Constant Field Values

### SQL_STATE_INVALID_TRANSACTION_TERMINATION

    public static final java.lang.String SQL_STATE_INVALID_TRANSACTION_TERMINATION

See Also:
  Constant Field Values

Constructor Detail

### SQLError

    public SQLError()

Method Detail

### convertShowWarningsToSQLWarnings

    static java.sql.SQLWarning convertShowWarningsToSQLWarnings(Connection connection)
                                                         throws java.sql.SQLException

  Turns output of 'SHOW WARNINGS' into JDBC SQLWarning instances. If 'forTruncationOnly' is true, only looks for truncation warnings, and actually throws DataTruncation as an exception.

  Parameters:
    `connection` - the connection to use for getting warnings.
  Returns:
    the SQLWarning chain (or null if no warnings)
  Throws:
    `java.sql.SQLException` - if the warnings could not be retrieved

### convertShowWarningsToSQLWarnings

    static java.sql.SQLWarning convertShowWarningsToSQLWarnings(Connection connection,
                                                                int warningCountIfKnown,
                                                                boolean forTruncationOnly)
                                                         throws java.sql.SQLException

  Turns output of 'SHOW WARNINGS' into JDBC SQLWarning instances. If 'forTruncationOnly' is true, only looks for truncation warnings, and actually throws DataTruncation as an exception.

  Parameters:
    `connection` - the connection to use for getting warnings.
    `warningCountIfKnown` - the warning count (if known), otherwise set it to 0.
    `forTruncationOnly` - if this method should only scan for data truncation warnings
  Returns:
    the SQLWarning chain (or null if no warnings)
  Throws:
    `java.sql.SQLException` - if the warnings could not be retrieved, or if data truncation is being scanned for and truncations were found.

### dumpSqlStatesMappingsAsXml

    public static void dumpSqlStatesMappingsAsXml()
                                           throws java.lang.Exception

  Throws:
    `java.lang.Exception`

### get

    static java.lang.String get(java.lang.String stateCode)

### mysqlToSqlState

    static java.lang.String mysqlToSqlState(int errno,
                                            boolean useSql92States)

  Map MySQL error codes to X/Open or SQL-92 error codes

  Parameters:
    `errno` - the MySQL error code
  Returns:
    the corresponding X/Open or SQL-92 error code

### createSQLException

    public static java.sql.SQLException createSQLException(java.lang.String message,
                                                           java.lang.String sqlState)

### createSQLException

    public static java.sql.SQLException createSQLException(java.lang.String message)

### createSQLException

    public static java.sql.SQLException createSQLException(java.lang.String message,
                                                           java.lang.String sqlState,
                                                           java.lang.Throwable cause)

### createSQLException

    public static java.sql.SQLException createSQLException(java.lang.String message,
                                                           java.lang.String sqlState,
                                                           int vendorErrorCode)

### createSQLException

    public static java.sql.SQLException createSQLException(java.lang.String message,
                                                           java.lang.String sqlState,
                                                           int vendorErrorCode,
                                                           boolean isTransient)

### createCommunicationsException

    public static java.sql.SQLException createCommunicationsException(ConnectionImpl conn,
                                                                      long lastPacketSentTimeMs,
                                                                      long lastPacketReceivedTimeMs,
                                                                      java.lang.Exception underlyingException)

### createLinkFailureMessageBasedOnHeuristics

    public static java.lang.String createLinkFailureMessageBasedOnHeuristics(ConnectionImpl conn,
                                                                             long lastPacketSentTimeMs,
                                                                             long lastPacketReceivedTimeMs,
                                                                             java.lang.Exception underlyingException,
                                                                             boolean streamingResultSetInPlay)

  Creates a communications link failure message to be used in CommunicationsException that (hopefully) has some better information and suggestions based on heuristics.

  Parameters:
    `conn` -
    `lastPacketSentTimeMs` -
    `underlyingException` -
    `streamingResultSetInPlay` -
  Returns:

### notImplemented

    public static java.sql.SQLException notImplemented()

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD