In JDBC, the Connection , Statement and ResultSet types have a getWarnings() method, which is specified to generate the first warning associated with objects of this type. The second and subsequent warnings, if they exist, are tied to the first warning (if it even exists, null is generated if there are no warnings).
The specifications say that warnings associated with objects of these types are cleared after certain actions. For example, warnings in a ResultSet are cleared when each new line is read.
The SQLWarning type is a subtype of SQLException . So will the presence of a warning indicate an exception? And will this exception be bound to the related object if the type of exception environment is SQLWarning ?
What interests me, and it could be a specific driver, as I know, when should I call getWarnings() and expect a non- null response? To deliver in another way is a warning that is present on the JDBC object and is accessible using getWarnings() only after this object raised an exception? (and is this exception a warning?)
Should I call getWarnings() to look for warnings after each JDBC "just to be sure" operation, if my goal is to keep track of every warning?
source share