org.springframework.jdbc.datasource.init

Class ScriptStatementFailedException

  • All Implemented Interfaces:
    java.io.Serializable


    public class ScriptStatementFailedException
    extends ScriptException
    Thrown by ScriptUtils if a statement in an SQL script failed when executing it against the target database.
    Since:
    3.0.5
    Author:
    Juergen Hoeller, Sam Brannen
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      ScriptStatementFailedException(java.lang.String stmt, int stmtNumber, EncodedResource encodedResource, java.lang.Throwable cause)
      Construct a new ScriptStatementFailedException.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static java.lang.String buildErrorMessage(java.lang.String stmt, int stmtNumber, EncodedResource encodedResource)
      Build an error message for an SQL script execution failure, based on the supplied arguments.
      • 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
    • Constructor Detail

      • ScriptStatementFailedException

        public ScriptStatementFailedException(java.lang.String stmt,
                                              int stmtNumber,
                                              EncodedResource encodedResource,
                                              java.lang.Throwable cause)
        Construct a new ScriptStatementFailedException.
        Parameters:
        stmt - the actual SQL statement that failed
        stmtNumber - the statement number in the SQL script (i.e., the nth statement present in the resource)
        encodedResource - the resource from which the SQL statement was read
        cause - the underlying cause of the failure
    • Method Detail

      • buildErrorMessage

        public static java.lang.String buildErrorMessage(java.lang.String stmt,
                                                         int stmtNumber,
                                                         EncodedResource encodedResource)
        Build an error message for an SQL script execution failure, based on the supplied arguments.
        Parameters:
        stmt - the actual SQL statement that failed
        stmtNumber - the statement number in the SQL script (i.e., the nth statement present in the resource)
        encodedResource - the resource from which the SQL statement was read
        Returns:
        an error message suitable for an exception's detail message or logging
        Since:
        4.2