Free Jobs

Java Forums: Core Java (15) J2EE (3) EJB (5) Servlet (3) JDBC (6) Hibernate (2) Struts (1) Swing (1) Oracle (7) JSP (4) Other (10)

Topic: What are the types of Exception Handling in JDBC JAVA

To get the Posted Questions details daily in your mail Click Here

Share this Post on Facebook/Twitter/Orkut Bookmark and Share

User: shruti888 Post Date: 05 Jun 2011 11:14

While accessing data we need to handle exception in JDBC using different types as and when needed

Main Content:

In this post I will be describing the types of Exception Handling in JDBC JAVA

There are three types of Exeption Handling in JDBC

a)SQLExeption : it is nothing but a subclass of exception class.

                SQLExeption object has two main method to know about exception

                Details namely getErrorCode() and getSQLState()


b)SQLWarning : it is nothing but a subclass of SQLExeption class.

                it is not thrown as execption but can be intentionally

                accessed by the code by calling getWarning() method of

                connection or statement object

c)DataTruncation :it is nothing but a subclass of SQLWarning class.

                   A datatrucation means you are not processing all the data returned

                   from a query before closing the connection.For example you executed

                   a query that is returning 20 rows and you processed only two rows and closing

                   the connection.


Thus we learned types of Exception Handling in JDBC JAVA

About Writer:
Hi I am Java Developer from Bangalore

Writer's Link:

Writer's Email:

Post Comment

Similar Articles Top ArticlesLatest Articles Other Articles by this Author Copyright © 2009-2011 | All Rights Reserved
All content of this website is protected by copyright laws and should not be reproduced in any form or by any means without written permission
(Best viewed in IE 8.0+ or Firefox 3.0+ at resolution of 1024 * 768 or higher)