apache derby db错误“请求的聚合(1.744)不存在”

lzfw57am  于 2021-06-27  发布在  Java
关注(0)|答案(2)|浏览(403)

我将apachederby数据库用于我所从事的一个java项目。
我已经创建了evaluationcoms表,现在我想插入相同的值。
我试着:

public void instertEvalComments(String comment) {
    try {
        stmt = conn.createStatement();// create a Statement

        stmt.execute("INSERT INTO EVALUATIONCOMS" 
                    + " VALUES ('" + comment + "')" );

        stmt.close();
    } catch (SQLException e) {
        e.printStackTrace();
    }
}

但我得到了一个错误:

java.sql.SQLException: The conglomerate (1.744) requested does not exist.
at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
at gr.aueb.dmst.StopSpread.Database.insterIntoEvalComments(Database.java:242)
at gr.aueb.dmst.StopSpread.ServerClientThread.run(ServerClientThread.java:304)
Caused by: ERROR XSAI2: The conglomerate (1.744) requested does not exist.
    at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
    at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
    at org.apache.derby.impl.store.access.heap.HeapConglomerateFactory.readConglomerate(Unknown Source)
    at org.apache.derby.impl.store.access.CacheableConglomerate.setIdentity(Unknown Source)
    at org.apache.derby.impl.services.cache.ConcurrentCache.find(Unknown Source)
    at org.apache.derby.impl.store.access.RAMAccessManager.conglomCacheFind(Unknown Source)
    at org.apache.derby.impl.store.access.RAMTransaction.findConglomerate(Unknown Source)
    at org.apache.derby.impl.store.access.RAMTransaction.findExistingConglomerate(Unknown Source)
    at org.apache.derby.impl.store.access.RAMTransaction.getStaticCompiledConglomInfo(Unknown Source)
    at org.apache.derby.impl.sql.compile.InsertNode.makeConstantAction(Unknown Source)
    at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
    at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
    at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
    ... 4 more

这是我第一次遇到这样的错误,我不知道为什么。
我会感谢你的帮助。
注意:我执行了相同的方法,只更改了schema中其他表的名称和列,一切正常。另外,我使用的所有其他数据库处理方法也可以很好地工作。

jhiyze9q

jhiyze9q1#

这是“不应该发生的”。你的数据库不知何故已经损坏了,很难仅仅从这些证据判断出发生了什么。
也许你的磁盘已满?也许你撞车了,但没有恢复好?也许您将derby数据库从硬盘的一个部分移动到了另一个部分,而derby引擎仍在该数据库上运行?恐怕我只是在猜测。
数据库中的每个表或索引在物理上存储为一个“聚合”,每个聚合都是硬盘上数据库文件夹中的一个单独文件。
通过查询 sysconglomerates 系统视图;把它和 systables 以期改善信息。看到了吗https://db.apache.org/derby/docs/10.15/ref/rrefsistabs39391.html 以及https://db.apache.org/derby/docs/10.15/ref/rrefsistabs24269.html
如果没有其他问题,此分析将帮助您了解哪些表已损坏,哪些文件丢失。
如果您可以重现这个问题,也许您可以更加注意到底发生了什么操作以及文件何时消失。

dced5bon

dced5bon2#

您是否尝试过先删除表,然后再次创建它,然后重试?它的命令“drop evaluationcoms”我有同样的问题,只是删除了他,使一个新的从一开始,但它坚持了相当多,只是,所以尝试告诉我!祝你好运

相关问题