Name

SQLException

Synopsis

A SQLException object is thrown by any JDBC method that encounters an error. SQLException extends the java.lang.Exception class and adds a vendor-specific error code and an XOPEN SQL state code. SQLException objects can be chained together. The next exception in the chain is retrieved via getNextException(), which returns null if there are no more exceptions available. The setNextException() method adds an exception to the end of the chain.

                  Passed To
public class SQLException extends Exception {
// Public Constructors
   public SQLException();  
   public SQLException( String reason);  
   public SQLException( String reason, String SQLState);  
   public SQLException(String reason, String SQLState, 
        int vendorCode);  
// Property Accessor Methods (by property name)
   public int getErrorCode();                                    // default:0
   public SQLException getNextException();                       // default:null
   public void setNextException( SQLException ex);               // synchronized
   public String getSQLState();                                  // default:null
}

Subclasses

BatchUpdateException, SQLWarning

Passed To

SQLException.setNextException(), javax.sql.ConnectionEvent.ConnectionEvent()

Returned By

SQLException.getNextException(), javax.sql.ConnectionEvent.getSQLException()

Thrown By

Too many methods to list.

Get Java Enterprise in a Nutshell, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.