Class Hierarchy    Previous  Next  Index

Class COM.cloudscape.database.JavaSQLException

java.lang.Object
    |
    +----java.lang.Throwable
            |
            +----java.lang.Exception
                    |
                    +----java.sql.SQLException
                            |
                            +----COM.cloudscape.database.JavaSQLException

public abstract class JavaSQLException
extends java.sql.SQLException
Copyright © 1998-2000, Informix Software, Inc. All rights reserved.

An extension of SQLException that allows access to underlying Throwables, to assist in debugging Java stored procedures and to provide more information for several Cloudscape exceptions.

This is a Cloudscape specific extension to JDBC to aid debugging problems that involve a Throwable thrown within Cloudscape or user-supplied Java classes. The JDBC API does not allow these Throwables to be returned to the user directly; SQLExceptions can only nest other SQLExceptions.

It is not guaranteed that an SQLException thrown by Cloudscape is an instance of JavaSQLException. A typical code fragment to investigate a problem is:

try {
// some database access code
...
} catch (SQLException sqle) {

do {
// display the SQL Exception
System.out.println(sqle.toString());
sqle.printStackTrace(System.err);

// Look for a Java exception - Cloudscape specific
if (sqle instanceof JavaSQLException) {
Throwable javaException = ((JavaSQLException) sqle).getJavaException();
if (javaException != null) {

// do something with the actual Java exception

}
}
sqle = sqle.getNextException();

} while (sqle != null);

// cleanup code
...
}

If an SQLException thrown by Cloudscape does wrap a Throwable, then the message of the SQLException will contain the message and the class name of the Throwable, and the stack trace of SQLException will be the stack trace of the Throwable.

JavaSQLExceptions are only guaranteed to be returned within the JVM running Cloudscape. If the JavaSQLException must go through a network, for example in a Weblogic environment, then the client will only receive an SQLException generated from the public interface of SQLException (message, state, severity). It will not contain all of the information in the actual JavaSQLException thrown by Cloudscape.

Cloudscape reserves the right to change, rename, or remove this interface at any time.

See Also:
java.sql.SQLException

Constructor Index

 o JavaSQLException()
No argument constructor to match super class.
 o JavaSQLException(String)
One argument constructor to match super class.
 o JavaSQLException(String, String)
Two argument constructor to match super class.
 o JavaSQLException(String, String, int)
Three argument constructor to match super class.

Method Index

 o getJavaException()
Get the Java exception that caused this SQLException.

Constructor Detail

 o JavaSQLException
protected JavaSQLException(java.lang.String reason,
                           java.lang.String SQLState,
                           int vendorCode)
          Three argument constructor to match super class.
See Also:
SQLException()
 o JavaSQLException
protected JavaSQLException(java.lang.String reason,
                           java.lang.String SQLState)
          Two argument constructor to match super class.
See Also:
SQLException()
 o JavaSQLException
protected JavaSQLException(java.lang.String reason)
          One argument constructor to match super class.
See Also:
SQLException()
 o JavaSQLException
protected JavaSQLException()
          No argument constructor to match super class.
See Also:
SQLException()

Method Detail

 o getJavaException
public abstract java.lang.Throwable getJavaException()
          Get the Java exception that caused this SQLException. If this SQLException resulted from a Java exception then this method will return the Java exception, otherwise null is returned.

The actual Java exception thrown within a user's Java class or during a Cloudscape operation is available for examination.

Returns:
A Java exception or null if this SQLException was not directly caused by a Java exception.

  Class Hierarchy    Previous  Next  Index