Hitachi

Hitachi Advanced Database Application Development Guide


12.3 SQL exception extension function

Multiple exception classes have been added as subclasses of SQLException. The following table lists the exception classes that are returned by JDBC 4.0 API and describes each class.

Table 12‒6: List of exception classes returned by JDBC 4.0 API and description of the classes

No.

Exception class name

Description

Connection status if an error occurs while connected

1

SQLNonTransientException

Indicates an error that is not transient. This exception is thrown when the SQL statement resulting in an error cannot be re-executed successfully.

Valid

2

SQLFeatureNotSupportedException

Thrown when the class value of SQLSTATE is 0A (unsupported function).

Valid

3

SQLNonTransientConnectionException

Thrown when the class value of SQLSTATE is 08 (connection violation).

--

4

SQLDataException

Thrown when the class value of SQLSTATE is 22 (data exception).

Valid

5

SQLIntegrityConstraintViolationException

Thrown when the class value of SQLSTATE is 23 (integrity constraint violation).

Valid

6

SQLInvalidAuthorizationSpecException

Thrown when the class value of SQLSTATE is 28 (specified authorization identifier is invalid).

--

7

SQLSyntaxErrorException

Thrown when the class value of SQLSTATE is 42 (syntax error or access rule violation).

Valid

8

SQLTransientException

Indicates a transient error. This exception is thrown when the SQL statement resulting in an error might be re-executed successfully.

Valid

9

SQLTransientConnectionException

Thrown when the class value of SQLSTATE is 08 (connection violation). This applies, for example, when the HADB server is starting or terminating.

--

10

SQLTransactionRollbackException

Thrown when the class value of SQLSTATE is 40 (transaction rolled back).

Valid

11

SQLTimeoutException

Thrown when a timeout occurs.

Valid

12

SQLRecoverableException

Thrown when the transaction resulting in an error might be re-executed successfully after a connection is re-established.

Invalid

13

SQLClientInfoException

Thrown by the Connection.setClientInfo method when there is one or more client properties that cannot be set.

--

Legend:

--: Not applicable.

Note

For details about the class values of SQLSTATE, see the topic SQLSTATE output format in the manual HADB Messages.

The following shows the inheritance relationships of the exception classes that have been added in JDBC 4.0 API.

java.sql.SQLException
  [Figure]
  [Figure] java.sql.SQLNonTransientException
  [Figure]    [Figure] java.sql.SQLFeatureNotSupportedException
  [Figure]    [Figure] java.sql.SQLNonTransientConnectionException
  [Figure]    [Figure] java.sql.SQLDataException
  [Figure]    [Figure] java.sql.SQLIntegrityConstraintViolationException
  [Figure]    [Figure] java.sql.SQLInvalidAuthorizationSpecException
  [Figure]    [Figure] java.sql.SQLSyntaxErrorException
  [Figure]
  [Figure] java.sql.SQLTransientException
  [Figure]    [Figure] java.sql.SQLTransientConnectionException
  [Figure]    [Figure] java.sql.SQLTransactionRollbackException
  [Figure]    [Figure] java.sql.SQLTimeoutException
  [Figure]
  [Figure] java.sql.SQLRecoverableException
  [Figure] java.sql.SQLClientInfoException

Each exception class directly uses the classes of the java.sql package. For details about and usage of individual methods provided by the exception classes, see the related JDBC standard documentation.

Important

If a method such as executeQuery that executes SQL statements times out by exceeding the time specified in the setQueryTimeout method or adb_clt_rpc_sql_wait_time, the JDBC standard dictates that SQLTimeoutException is thrown. However, because the connection with the HADB server is always lost if a timeout occurs when a HADB client is waiting for the HADB server to respond to a processing request, SQLRecoverableException is thrown instead.