The Artima Developer Community
Sponsored Link

Java Answers Forum
Obtain SQL status

1 reply on 1 page. Most recent reply: Jul 28, 2003 6:24 AM by Adam Duffy

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Mike

Posts: 4
Nickname: mhirst
Registered: Jul, 2003

Obtain SQL status Posted: Jul 25, 2003 12:01 PM
Reply to this message Reply
Advertisement
I want to get the SQL State from preparded and executed statements that do not throw SQLExceptons. How do you do this.


Adam Duffy

Posts: 168
Nickname: adamduffy
Registered: Feb, 2003

Re: Obtain SQL status Posted: Jul 28, 2003 6:24 AM
Reply to this message Reply
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

Flat View: This topic has 1 reply on 1 page
Topic: Counting lines in text file Previous Topic   Next Topic Topic: How do I get this to the Window?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use