Results 1 to 3 of 3

Thread: Find line that throws an exception

  1. #1
    Junior Member
    Join Date
    Feb 2006
    Answers
    5

    Find line that throws an exception

    In a JDBC Application,

    (1) Loading the Driver,
    (2) Statement Creation,
    (3) ResultSet all thorw SQLException.

    when we put this code in single try/catch block, how do we know which code of line thrown an Exception? I mean, it should be either of (1), (2) and (3).

    How do we distinguish them? Any Advices Appreciated.


  2. #2
    Contributing Member
    Join Date
    Sep 2006
    Answers
    962

    Re: Find line that throws an exception

    My opinion is after each statement you need to print some message. If message print your console then that statement does not have a problem. Otherwise that will throw on Exception.

    --------------------
    suresh


  3. #3
    Junior Member
    Join Date
    Jan 2007
    Answers
    22

    Re: Find line that throws an exception

    when an exception is thrown print the stack trace and see which method actully cused the exception.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact