Adam Duffy
Posts: 168
Nickname: adamduffy
Registered: Feb, 2003
|
|
Re: Obtain SQL status
|
Posted: Jul 28, 2003 6:24 AM
|
|
Taken from
http://java.sun.com/docs/books/tutorial/jdbc/basics/complete.html
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. For example, a warning might let you know that a privilege you attempted to revoke was not revoked. Or a warning might tell you that an error occurred during a requested disconnection.
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. If getWarnings returns a warning, you can call the SQLWarning method getNextWarning on it to get any additional warnings.
Since SQLWarning extends SQLException you can call the getSQLState method on each warning (if any) returned.
Adam
|
|