Is SQLException run time or compile time exception?

Questions by naggeek

Showing Answers 1 - 24 of 24 Answers

ans_2008

  • Jan 2nd, 2008
 

SQL Exception is Run Time Exception Call a store Procedure give one less parameter declaration it will compile but give Error when you run your Application

  Was this answer useful?  Yes

SQLException is absolutely a compile time excpeption. If you declare sqlexception in the code ,then trying to compile it ,will give error..(you should catch the exception )..so it is compile time exception

If any doubts please try to compile it..you will get solution

  Was this answer useful?  Yes

The exception is thrown at run time. The compile time complaint you are seeing is because the underlying class throws SQLException which should be handled by either a try catch block or including throws clause at the method declaration.

  Was this answer useful?  Yes

trcdutt

  • Apr 17th, 2008
 

It is a compile time exception (Checked Exception). Anything that inherits Exception class is a compile time exception and any class that inherit from RuntimeException and Error classes are unchecked Exceptions (Runtime Exceptions). SQLException is a direct subclass of Exception which means it is a checked exception. Refer to the link from Java Language spec:

http://java.sun.com/docs/books/jls/second_edition/html/exceptions.doc.html

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions