InterviewSolution
| 1. |
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(); 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(); |
|