Friday, March 13, 2009

Consider the following code:

Question :Consider the following code:
Class.forName("mypackage.MyClass");
Connection con = DriverManager.getConnection("some connection
string");
What Exceptions can be thrown in the above statements?
(JDBC)

Answer :The above statements can throw any or all of the following exceptions
LinkageError - if the linkage fails
ExceptionInInitializerError - if the initialization provoked by this method
fails
ClassNotFoundException - if the class cannot be located
SQLException - if a database access error occurs

No comments: