|
INTERVIEW QUESTIONS
J2EE
JSP
DETAILS
Question: How to Retrieve Warnings?
Answer: SQLWarning objects are a subclass of SQLException that deal with database access warnings. Warnings do not stop the execution of an application, as exceptions do; they simply alert the user that something did not happen as planned. A warning can be reported on a Connection object, a Statement object (including PreparedStatement and CallableStatement objects), or a ResultSet object. Each of these classes has a getWarnings method, which you must invoke in order to see the first warning reported on the calling object
SQLWarning warning = stmt.getWarnings(); if (warning != null) { while (warning != null) { System.out.println("Message: " + warning.getMessage()); System.out.println("SQLState: " + warning.getSQLState()); System.out.print("Vendor error code: "); System.out.println(warning.getErrorCode()); warning = warning.getNextWarning(); } }
|
|
|
Category |
JSP Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.2) By 9445 users |
Added on |
9/16/2014 |
Views |
70971 |
Rate it! |
|
|
Question:
How to Retrieve Warnings?
Answer:
SQLWarning objects are a subclass of SQLException that deal with database access warnings. Warnings do not stop the execution of an application, as exceptions do; they simply alert the user that something did not happen as planned. A warning can be reported on a Connection object, a Statement object (including PreparedStatement and CallableStatement objects), or a ResultSet object. Each of these classes has a getWarnings method, which you must invoke in order to see the first warning reported on the calling object
SQLWarning warning = stmt.getWarnings(); if (warning != null) { while (warning != null) { System.out.println("Message: " + warning.getMessage()); System.out.println("SQLState: " + warning.getSQLState()); System.out.print("Vendor error code: "); System.out.println(warning.getErrorCode()); warning = warning.getNextWarning(); } } Source: CoolInterview.com
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|
|
Related Questions |
View Answer |
|
What Class.forName will do while loading drivers?
|
View Answer
|
|
What information is needed to create a TCP Socket?
|
View Answer
|
|
How many messaging models do JMS provide for and what are they?
|
View Answer
|
|
The code in a finally clause will never fail to execute, right?
|
View Answer
|
|
How can a servlet refresh automatically if some new data has entered the database?
|
View Answer
|
|
Can we use the constructor, instead of init(), to initialize servlet?
|
View Answer
|
|
Is JSP technology extensible?
|
View Answer
|
|
Why are JSP pages the preferred API for creating a web-based client program?
|
View Answer
|
|
How many JSP scripting elements and what are they?
|
View Answer
|
|
What are the implicit objects?
|
View Answer
|
|
What is JSP technology?
|
View Answer
|
|
What are the two kinds of comments in JSP and what's the difference between them ?
|
View Answer
|
|
What is difference between custom JSP tags and beans?
|
View Answer
|
|
What is a JSP and what is it used for?
|
View Answer
|
|
What is JSP tag handler ?
|
View Answer
|
|
What is JSP tag file ?
|
View Answer
|
|
What is JSP standard action ?
|
View Answer
|
|
What is JSP scriptlet ?
|
View Answer
|
|
What is JSP scripting element ?
|
View Answer
|
|
What is JSP expression language ?
|
View Answer
|
Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.
View All JSP Interview Questions & Answers - Exam Mode /
Learning Mode
|