com.mysql.cj.exceptions

## Class CJException

- java.lang.Object
- - java.lang.Throwable
  - - java.lang.Exception
    - - java.lang.RuntimeException
      - - com.mysql.cj.exceptions.CJException

All Implemented Interfaces:
  Serializable

Direct Known Subclasses:
  AssertionFailedException, CJCommunicationsException, CJOperationNotSupportedException, CJPacketTooBigException, CJTimeoutException, ClosedOnExpiredPasswordException, ConnectionIsClosedException, DataReadException, DataTruncationException, FeatureNotAvailableException, InvalidConnectionAttributeException, OperationCancelledException, PasswordExpiredException, PropertyNotModifiableException, RSAException, SSLParamsException, StatementIsClosedException, UnableToConnectException, UnsupportedConnectionStringException, WrongArgumentException, XDevAPIError

    public class CJException
    extends RuntimeException

The base unchecked exception thrown internally in connector.

See Also:
  Serialized Form

### Field Summary

Fields
`protected String` `exceptionMessage` We can't override the `Throwable.detailMessage` directly because it has a private accessibility, thus for that need we use this protected variable and override `getMessage()`
`private boolean` `isTransient`
`private static long` `serialVersionUID`
`private String` `SQLState`
`private int` `vendorCode`

### Constructor Summary

Constructors
`` `CJException()`
`` `CJException(String message)`
`` `CJException(String message, Throwable cause)`
`protected` `CJException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace)`
`` `CJException(Throwable cause)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `appendMessage(String messageToAppend)`
`String` `getMessage()`
`String` `getSQLState()`
`int` `getVendorCode()`
`boolean` `isTransient()`
`void` `setSQLState(String sQLState)`
`void` `setTransient(boolean isTransient)`
`void` `setVendorCode(int vendorCode)`

### Methods inherited from class java.lang.Throwable

`addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### serialVersionUID

    private static final long serialVersionUID

See Also:
  Constant Field Values

#### exceptionMessage

    protected String exceptionMessage

We can't override the `Throwable.detailMessage` directly because it has a private accessibility, thus for that need we use this protected variable and override `getMessage()`

#### SQLState

    private String SQLState

#### vendorCode

    private int vendorCode

#### isTransient

    private boolean isTransient

### Constructor Detail

#### CJException

    public CJException()

#### CJException

    public CJException(String message)

#### CJException

    public CJException(Throwable cause)

#### CJException

    public CJException(String message,
                       Throwable cause)

#### CJException

    protected CJException(String message,
                          Throwable cause,
                          boolean enableSuppression,
                          boolean writableStackTrace)

### Method Detail

#### getSQLState

    public String getSQLState()

#### setSQLState

    public void setSQLState(String sQLState)

#### getVendorCode

    public int getVendorCode()

#### setVendorCode

    public void setVendorCode(int vendorCode)

#### isTransient

    public boolean isTransient()

#### setTransient

    public void setTransient(boolean isTransient)

#### getMessage

    public String getMessage()

Overrides:
  `getMessage` in class `Throwable`

#### appendMessage

    public void appendMessage(String messageToAppend)

Copyright © 2016, 2026, Oracle and/or its affiliates.