what are the Different types of exceptions in JDBC?

Answer Posted / venu gopal.c t.c.s

Exceptions in JDBC are usually of two types:

Exceptions occurring in the JDBC driver

Exceptions occurring in the Oracle 8i database itself

Just as PL/SQL provides for an implicit or explicit RAISE
statement for an exception, Oracle JDBC programs have a
throw statement that is used to inform that JDBC calls
throw the SQL exceptions. This is shown below.

throws SQLException
This creates instances of the class java.sql.SQLException
or a subclass of it.

And, like in PL/SQL, SQL exceptions in JDBC have to be
handled explicitly. Similar to PL/SQL exception handling
sections, Java provides a try..catch section that can
handle all exceptions including SQL exceptions. Handling an
exception can basically include retrieving the error code,
error text, the SQL state, and/or printing the error stack
trace. The SQLException class provides methods for
obtaining all of this information in case of error
conditions.

Is This Answer Correct ?    9 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of jdbc?

554


What is addbatch jdbc?

531


How can we execute stored procedures using callablestatement?

465


What are the standard isolation levels defined by JDBC?

567


What is jdbc connection?

648






Explain the importance of drivermanager.

708


What is the difference between setmaxrows(int) and setfetchsize(int)?

556


What is type 4 jdbc driver?

477


In which ways is driver class is registered with drive manager?

519


Explain in detail about JDBC and its general features?

524


What happens if we don't close the connection in jdbc?

479


What is jdbc odbc bridge in java?

536


Name the method, which is used to prepare a callablestatement.

503


What are the differences between execute, executequery, and executeupdate?

483


How do we call a stored procedure from jdbc?

549