O'Reilly logo

Apache Derby—Off to the Races: Includes Details of IBM® Cloudscape™ by Dan Scott, George Baklarz, Paul C. Zikopoulos

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required