JSP General - How to Retrieve SQLWarning
Interview Question Database For Software Developers
|
|
| How to Retrieve SQLWarning | | How to Retrieve SQLWarning? | | By: FYICENTER.com | 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.print("Message: ");
System.out.println(warning.getMessage());
System.out.print("SQLState: ");
System.out.println(warning.getSQLState());
System.out.print("Vendor error code: ");
System.out.println(warning.getErrorCode());
warning = warning.getNextWarning();
}
}
| | ID: 190 | Rank: 1283 | Votes: 0 | Views: 109 | Submitted: 20070403 |
Copyright © 2010 FYIcenter.com
All rights in the contents of this Website are reserved by the individual author.
No part of the contents may be reproduced in any form without author's permission.
|
|
|