Nonstop Database, HiRDB Version 9 UAP Development Guide

[Contents][Index][Back][Next]

18.4.12 SQLWarning interface

Organization of this subsection
(1) Overview
(2) Notes

(1) Overview

The SQLWarning interface provides the following principal function:

If a method object triggers a warning report, an SQLWarning object is accumulated without an exception notice to that method object.

(2) Notes

(a) Releasing accumulated SQLWarning objects

SQLWarning objects are accumulated as a chain linked to the method object (Connection, Statement, PreparedStatement, CallableStatement, or ResultSet) that triggers the warning reports.

To release accumulated SQLWarning objects explicitly, execute the clearWarnings method for the method object that triggered the warnings.

(b) Issuing conditions for SQLWarning objects

If the specified warning retention level indicates that warnings that occur during SQL execution are to be retained in the JDBC driver, the JDBC driver generates SQLWarning objects and retains warning information. In addition, a property can be used to specify warning retention for Connection objects.

The following table describes the conditions under which SQLWarning objects are generated.

Table 18-55 Conditions for generation of SQLWarning objects

SQL execution result Warning retention specification for Connection object
Warning is retained Warning is not retained
Warning retention level Warning retention level
IGNORE SQLWARN ALLWARN IGNORE SQLWARN ALLWARN
SQLCODE is a value greater than 0 other than 100, 110, or 120 Generated by an object other than a Connection object No No Yes No No Yes
Generated by a Connection object No No Yes No No No
SQLWARN0 of the SQL Communications Area is W (except when SQLWARN6 is W) Generated by an object other than a Connection object No Yes Yes No Yes Yes
Generated by a Connection object No Yes Yes No No No
Warning occurs in the JDBC driver Generated by an object other than a Connection object No Yes Yes No Yes Yes
Generated by a Connection object No Yes Yes No No No

Legend:
Yes: An SQLWarning object is generated.
No: An SQLWarning object is not generated.

Note
You can use SQLWARNING_IGNORE for URL, the SQLWARNING_IGNORE user property, or the setSQLWarningIgnore method to specify the warning retention specification for Connection objects. The default is false.
You can use SQLWARNING_LEVEL for URL, the HiRDB_for_Java_SQLWARNING_LEVEL property, or the setSQLWarningLevel method to specify the warning retention level. The default is SQLWARN.