Trapping SQLExceptions

All SQL statements should have some form of try block around them. This will help the application trap any errors that can arise from improper SQL, missing database objects, or general database errors. The errors generated by SQL statements are referred to as SQLCODEs or SQLSTATEs. SQLCODEs are used by other database managers, but the standard errors in Apache Derby are handled as SQLSTATEs.

All SQL that completes successfully will have a '00000' SQLSTATE. However, there might be situations in which a statement causes a warning that is acceptable to the application. For this reason, the SQLSTATE and error codes need to be examined to determine whether the application can continue running. An example of an error that can ...

Get Apache Derby—Off to the Races: Includes Details of IBM® Cloudscape™ 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.