JDBC errors are thrown as exceptions. The specific class for representing these errors is java.sql.SQLException. As with any other exception, the appearance of an SQLException signifies that something has gone wrong and needs to be appropriately handled.
SQL warnings are represented by an instance of the java.sql.SQLWarning class that derives from the java.sql.SQLException class. It provides information on database access warnings. Unlike serious exceptions, SQL warnings are silently chained to the object whose method caused it to be reported.
SQLExceptions store three pieces of information:
A string describing the error.
An SQLstate string, which follows the X/OPEN SQLstate conventions. ...