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

Result set’s index starts with 0 or 1?

759


Where is jdbc url mysql?

704


Is jdbc database independent?

704


How to retrieve warnings in jdbc?

729


Which jdbc drivers will run your program?

700


What is the use of setFetchSize() and setMaxRows() methods in Statement?

724


How to insert and delete a row programmatically? (new feature in JDBC 2.0)

741


How many types of jdbc drivers are there?

748


Does jdbctemplate use prepared statements?

692


What are the types of jdbc drivers that exist?

724


What is JDBC DataSource and what are it’s benefits?

740


Is not bound in this context unable to find jdbc spring boot?

681


State the different connection methods used for creating different types of sql.

759


What is the JDBC?

752


What do you mean by odbc?

781