我正在使用derby DB。 我正在尝试关闭数据库。我正在接收:
----- SQLException -----
SQL State: XJ004
Error Code: 40000
Message: Database '<db name>' not found.
我可以找到这里列出的SQL状态:http://db.apache.org/derby/docs/10.8/ref/rrefexcept71493.html
它列出了XJ004: Database '<databaseName>' not found.
但是,我找不到德比的错误代码列表。
错误代码列表在哪里?
Derby 使用 SQLException 中的错误代码来表示异常严重性。
JDBC 驱动程序从 Derby 返回所有错误的 SQLExceptions。如果 异常源自用户类型,但本身不是 SQLException,它被包装在一个SQLException中。德比专用 SQLExceptions 使用以 X 开头的 SQLState 类代码。 在适当的情况下,将为异常返回 SQLState 值。
Derby 数据库异常按严重性分类。的严重性 SQLException 可通过 getErrorCode 方法调用获得 SQLException。严重程度总结如下。欲了解更多信息 信息,请查看 javadoc org.apache.derby.types.ExceptionSernity:
常量为:
/**
* NO_APPLICABLE_SEVERITY occurs only when the system was
* unable to determine the severity.
*/
public static final int NO_APPLICABLE_SEVERITY = 0;
/**
* WARNING_SEVERITY is associated with SQLWarnings.
*/
public static final int WARNING_SEVERITY = 10000;
/**
* STATEMENT_SEVERITY is associated with errors which
* cause only the current statement to be aborted.
*/
public static final int STATEMENT_SEVERITY = 20000;
/**
* TRANSACTION_SEVERITY is associated with those errors which
* cause the current transaction to be aborted.
*/
public static final int TRANSACTION_SEVERITY = 30000;
/**
* SESSION_SEVERITY is associated with errors which
* cause the current connection to be closed.
*/
public static final int SESSION_SEVERITY = 40000;
/**
* DATABASE_SEVERITY is associated with errors which
* cause the current database to be closed.
*/
public static final int DATABASE_SEVERITY = 45000;
/**
* SYSTEM_SEVERITY is associated with internal errors which
* cause the system to shut down.
*/
public static final int SYSTEM_SEVERITY = 50000;