Cloudscape Exception Messages and SQL States,
Page 1 of 1


[top]
[prev]
[next]
Documentation Top
Global Index
Reference Manual
TOC Index
Grammar index
Developer's Guide
TOC Index
Tuning Cloudscape
TOC Index

5 Cloudscape Exception Messages and SQL States

The JDBC driver returns SQLExceptions for all errors from Cloudscape. If the exception originated in a user type but is not itself an SQLException, it is wrapped in an SQLException. Cloudscape-specific SQLExceptions use SQLState class codes starting with X. Standard SQLState values are returned for exceptions where appropriate.

Cloudscape database exceptions are classified by severity. The severity of an SQLException is available through the getErrorCode method call on the SQLException. The severities are summarized below. For more information, check the javadoc for COM.cloudscape.types.JBMSExceptionSeverity:

  • Statement Severity—the effects of the current statement, if any, on persistent data are undone.
  • Transaction Severity—the effects of the current transaction on persistent data are undone; a rollback is performed.
  • Session Severity—a rollback is performed and the current session is terminated. This closes the current connection.
  • System Severity—the system is shut down. All uncommitted transactions are rolled back.

Cloudscape provides a class, COM.cloudscape.database.JBMSException, for checking the severity of an exception.

Unimplemented aspects of the JDBC driver return an SQLException with a message starting “Feature not implemented” and an SQLState of XJZZZ. These unimplemented parts are for features not supported by Cloudscape.

Cloudscape supplies values for the message and SQLState fields. In addition, Cloudscape sometimes returns multiple SQLExceptions using the nextException chain. The first exception is always the most severe exception, with SQL-92 Standard exceptions preceding those that are specific to Cloudscape.

For information on processing SQLExceptions, see “Working with Cloudscape SQLExceptions in an Application” in the Cloudscape Developer’s Guide.

SQLStates for some common errors:

  • deadlock
    40001
  • foreign key violation
    23501
  • check constraint violation
    23L02
  • duplicate value violating unique or primary key constraint
    23500
  • duplicate value violating unique index
    23L01
  • truncation error
    22001
  • user authorization error
    XJ006
  • user authentication error (no permission to access database)
    04501
  • user authentication error (no write access)
    22502

NOTE: Cloudscape reserves the right to change the SQLState of Cloudscape errors.

[top]
[prev]
[next]


Cloudscape Version 3.0
For technical support, go to: www.cloudscape.com and click Support.
Copyright © 1998 and 1999 Cloudscape, Inc. All rights reserved.