Handling errors and warnings in JDBC applications

A Java application uses its own way of catching exceptions. An error is commonly referred to as an exception in Java applications. An exception can be recognized by an exception class. A try block can have multiple catch blocks. The idea is to handle every possibility of the error condition. JDBC also provides some standard exception classes that can be used to capture the basic information. Apart from them, DB2 also provides its own exception classes that can be used for better diagnosis. In this recipe, we will focus on exception handling in Java applications.

Getting ready

JDBC applications use try and catch blocks to handle different exceptions. There is no exception thrown in the case of warnings. ...

Get IBM DB2 9.7 Advanced Application Developer Cookbook 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.