- JDBC 4.0 and Oracle JDeveloper for J2EE Development
- Deepak Vohra
- 207字
- 2021-08-25 18:08:45
JDBC Exceptions
SQLException
is the main Exception
that is generated in a JDBC application. The detail of an SQL exception can be obtained from an SQLException
object using the SQLException
methods, some of which are discussed in following table:

When an SQLException
occurs, it is likely that one or more SQLExceptions
chained to it, have also occurred. The chained exceptions can be retrieved by invoking the getNextException()
method recursively, until the method returns null. The cause of an SQLException
can be retrieved using the getCause()
method. The chained causes can be also be retrieved by invoking the getCause()
method recursively, until the value, null, is returned.
If SQLException
is generated output the exception message using the getMessage()
method, output the exception causes using the getCause()
method recursively, and retrieve exceptions chained to the exception using the getNextException()
method recursively:
catch(SQLException e) { while(e != null) { System.out.println("SQLException Message:" + e.getMessage()); Throwable t = e.getCause(); while(t != null) { System.out.println("SQLException Cause:" + t); t = t.getCause(); } e = e.getNextException(); } }
Some of the subclasses in the SQLException
class are listed in following table:

JDBC 4.0 has added support for categorization of SQLExceptions
and enhanced support for chained SQLExceptions
, which we will discuss in a later section.
- Oracle Business Intelligence : The Condensed Guide to Analysis and Reporting
- 從零開始:AutoCAD 2015中文版機械制圖基礎培訓教程
- SolidWorks 2021中文版機械設計從入門到精通
- Pro/E Wildfire 5.0中文版入門、精通與實戰
- Microsoft SharePoint 2010 Administration Cookbook
- 中文版CorelDRAW X8基礎培訓教程(全彩版)
- 大規模組織DevOps實踐
- Salesforce CRM: The Definitive Admin Handbook
- PS App UI設計從零開始學
- SolidWorks快速入門教程(2022中文版)
- Photoshop插畫藝術火星風暴
- Vue.js實戰
- PPT設計與制作實戰教程
- 中文版CorelDRAW X7基礎培訓教程
- 中文版3ds Max 2014基礎培訓教程