Chaining SQLExceptions

In this chapter you will learn:

  1. Find out Chaining SQLExceptions

Find out Chaining SQLExceptions

} catch (SQLException sqle) {
  do { // loop through each exception
    // do something with each exception
    System.err.println("Exception occurred:\nMessage: " + sqle.getMessage());
    System.err.println("SQL state: " + sqle.getSQLState());
    System.err.println("Vendor code: " + sqle.getErrorCode() + "\n----------------");
  } while ((sqle = sqle.getNextException()) != null);
}/*j  a v  a2  s. co m*/

Next chapter...

What you will learn in the next chapter:

  1. Find out Warning message for Connection
  2. Check for a warning using a Connection object
  3. Print warning message from connection
Home » Java Tutorial » Statements, ResultSet, Exception, Warning

Statement

    Three types of statements
    Statement interface
    Insert
    Delete records
    Drop a table
    Batch operation

PreparedStatement

    PreparedStatement
    Insert
    Delete
    Update with parameters
    Batch operation
    ParameterMetaData
    Fetch size
    Set null vaue

CallableStatement

    CallableStatement

ResultSet

    ResultSet
    ResultSet Type
    ResultSet Concurrency
    Create a ResultSet
    ResultSet reading
    ResultSet get by column name
    ResultSet get column by index
    ResultSet next row
    ResultSet table row count
    ResultSet navigation
    ResultSet cursor forward and backward
    ResultSet first
    ResultSet last
    ResultSet after last
    ResultSet before first
    ResultSet absolute(2)
    ResultSet absolute(-1)
    ResultSet relative(-2)
    ResultSet relative(-2)
    ResultSet update
    Column Names
    Column count
    Column Characteristics

ResultSetMetaData

    Column Names
    Column count
    Column Characteristics

SQL Exception, SQL Warning

    SQL Exception
    SQLException information
    Chaining SQLExceptions
    Connection Warning
    PreparedStatement SQLWarning
    Statement SQLWarning
    ResultSet warning
    SQLWarning information