Advertisement

07.22.2008 at 01:54PM PDT, ID: 23586585
[x]
Attachment Details

Why is my code not catching an SQL exception?

Asked by g118481 in Java Programming Language, Java Server Pages (JSP)

Tags: java

My code is working fine for this JSP page.
However, if bad SQL is passed to the page it will error out with a NULL pointer exception.

I have this catch below to show what the SQL exception error is, but it is not working:

     try {
        stmt = conn.createStatement();
        result = stmt.executeQuery(""+QRYTEXT.trim()+"");
     }
     catch (SQLException e) {
         System.out.println("Error occurred " + e);
      }

Should I be using something else to capture the error?

ThanksStart Free Trial
[+][-]07.22.2008 at 01:58PM PDT, ID: 22063605

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Java Programming Language, Java Server Pages (JSP)
Tags: java
Sign Up Now!
Solution Provided By: angelIII
Participating Experts: 3
Solution Grade: A
 
 
[+][-]07.22.2008 at 01:58PM PDT, ID: 22063610

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 01:58PM PDT, ID: 22063612

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 02:03PM PDT, ID: 22063649

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]07.23.2008 at 01:08AM PDT, ID: 22066940

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 02:44AM PDT, ID: 22067434

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 04:55AM PDT, ID: 22068108

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628