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
How can I know when I reach the last record in a table, since JDBC doesn't provide an EOF method?
How can we retrieve the file in the oracle database?
What is database connection pooling? Advantages of using a connection pool?
Explain what should be done when a SQL exception is raised?
I have the choice of manipulating database data using a byte[] or a java.sql.blob. Which has best performance?
Is jdbc object oriented?
Why isn't the java.sql.DriverManager class being found?
What does jdbc do?
Which is better jpa or jdbc?
What does the jdbc connection interface?
What is JDBC Connection isolation levels?
Why is jdbc used?
Is not bound in this context unable to find jdbc spring boot?
What is “dirty read” in JDBC? Which isolation level prevents dirty read?
Once I have the Java 2 SDK, Standard Edition, from Sun, what else do I need to connect to a database?