Class SQLError

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

public class SQLError
extends java.lang.Object
SQLError is a utility class that maps MySQL error codes to SQL error codes as is required by the JDBC spec.
  • Constructor Details

  • Method Details

    • createSQLException

      public static java.sql.SQLException createSQLException​(java.lang.String message, java.lang.String sqlState, ExceptionInterceptor interceptor)
    • createSQLException

      public static java.sql.SQLException createSQLException​(java.lang.String message, ExceptionInterceptor interceptor)
    • createSQLException

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

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

      public static java.sql.SQLException createSQLException​(java.lang.String message, java.lang.String sqlState, int vendorErrorCode, java.lang.Throwable cause, ExceptionInterceptor interceptor)
    • createSQLException

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

      public static java.sql.SQLException createSQLException​(java.lang.String message, java.lang.String sqlState, int vendorErrorCode, boolean isTransient, java.lang.Throwable cause, ExceptionInterceptor interceptor)
    • createCommunicationsException

      public static java.sql.SQLException createCommunicationsException​(JdbcConnection conn, PacketSentTimeHolder packetSentTimeHolder, PacketReceivedTimeHolder packetReceivedTimeHolder, java.lang.Exception underlyingException, ExceptionInterceptor interceptor)
    • createCommunicationsException

      public static java.sql.SQLException createCommunicationsException​(java.lang.String message, java.lang.Throwable underlyingException, ExceptionInterceptor interceptor)
    • createBatchUpdateException

      public static java.sql.SQLException createBatchUpdateException​(java.sql.SQLException underlyingEx, long[] updateCounts, ExceptionInterceptor interceptor) throws java.sql.SQLException
      Create a BatchUpdateException taking in consideration the JDBC version in use. For JDBC version prior to 4.2 the updates count array has int elements while JDBC 4.2 and beyond uses long values.
      Parameters:
      underlyingEx - underlying exception
      updateCounts - update counts of completed queries in this batch
      interceptor - exception interceptor
      Returns:
      SQLException
      Throws:
      java.sql.SQLException - if an error occurs
    • createSQLFeatureNotSupportedException

      public static java.sql.SQLException createSQLFeatureNotSupportedException()
      Create a SQLFeatureNotSupportedException or a NotImplemented exception according to the JDBC version in use.
      Returns:
      SQLException
    • createSQLFeatureNotSupportedException

      public static java.sql.SQLException createSQLFeatureNotSupportedException​(java.lang.String message, java.lang.String sqlState, ExceptionInterceptor interceptor) throws java.sql.SQLException
      Create a SQLFeatureNotSupportedException or a NotImplemented exception according to the JDBC version in use.
      Parameters:
      message - error message
      sqlState - sqlState
      interceptor - exception interceptor
      Returns:
      SQLException
      Throws:
      java.sql.SQLException - if an error occurs