Class Hierarchy Previous Next Index
java.lang.Object | +----java.lang.Throwable | +----java.lang.Exception | +----java.sql.SQLException | +----COM.cloudscape.database.JavaSQLException
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.
protected JavaSQLException(java.lang.String reason, java.lang.String SQLState, int vendorCode)
protected JavaSQLException(java.lang.String reason, java.lang.String SQLState)
protected JavaSQLException(java.lang.String reason)
protected JavaSQLException()
public abstract java.lang.Throwable getJavaException()
The actual Java exception thrown within a user's Java class or during a Cloudscape operation is available for examination.
Class Hierarchy Previous Next Index