Error Handling and SQL Warnings

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.

Handling SQLException Errors

SQLExceptions store three pieces of information:

  • A string describing the error.

  • An SQLstate string, which follows the X/OPEN SQLstate conventions. ...

Get J2EE™ Applications and BEA™ WebLogic Server™ 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.