我尝试从数据库Derby DB中选择数据时出现奇怪的错误

时间:2014-12-09 19:04:22

标签: java derby

我有一个奇怪的错误。我用java和derby数据库编写了一个应用程序。所以我使用这个应用程序1年,但是从3天开始我尝试执行查询以提取数据时出现此错误,但我没有更改代码。 如果我尝试为选择数据执行所有方法,则会出现此错误:

DEBUG [AWT-EventQueue-0] (MyLog4J.java:45) - java.sql.SQLException: Formato pagina sconosciuto alla pagina Page(51,Container(0, 1136)), segue il dump di pagina: Hex dump:
00000000: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000010: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000ff0: 0000 0000 0000 0000 0000 0000 0000 0000  ................

    at org.apache.derby.impl.jdbc.SQLExceptionFactory40.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.executeStatement(Unknown Source)
    at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown Source)
    at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeQuery(Unknown Source)
    at esempio.Visualizzazioni.estraiMesiEAnno(Visualizzazioni.java:286)
    at com.mcsolution.easyMgmt.Amministrazione.AbstractAmministrazione.settaVariabiliComuni(AbstractAmministrazione.java:108)
    at com.mcsolution.easyMgmt.Amministrazione.PanelAmministrazione.creaSwing(PanelAmministrazione.java:102)
    at esp.TestaFrame$MenuLookDemo22$7.actionPerformed(TestaFrame.java:358)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
    at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
    at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:809)
    at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:850)
    at java.awt.Component.processMouseEvent(Component.java:6297)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3275)
    at java.awt.Component.processEvent(Component.java:6062)
    at java.awt.Container.processEvent(Container.java:2039)
    at java.awt.Component.dispatchEventImpl(Component.java:4660)
    at java.awt.Container.dispatchEventImpl(Container.java:2097)
    at java.awt.Component.dispatchEvent(Component.java:4488)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4575)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4236)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4166)
    at java.awt.Container.dispatchEventImpl(Container.java:2083)
    at java.awt.Window.dispatchEventImpl(Window.java:2489)
    at java.awt.Component.dispatchEvent(Component.java:4488)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:674)
    at java.awt.EventQueue.access$400(EventQueue.java:81)
    at java.awt.EventQueue$2.run(EventQueue.java:633)
    at java.awt.EventQueue$2.run(EventQueue.java:631)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
    at java.awt.EventQueue$3.run(EventQueue.java:647)
    at java.awt.EventQueue$3.run(EventQueue.java:645)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:644)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: java.sql.SQLException: Formato pagina sconosciuto alla pagina Page(51,Container(0, 1136)), segue il dump di pagina: Hex dump:
00000000: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000010: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000020: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000030: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000040: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000050: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000060: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000ff0: 0000 0000 0000 0000 0000 0000 0000 0000  ................

    at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
    at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
    ... 51 more
Caused by: ERROR XSDBB: Formato pagina sconosciuto alla pagina Page(51,Container(0, 1136)), segue il dump di pagina: Hex dump:
00000000: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000010: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000020: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000030: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000040: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000050: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000920: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000930: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000940: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000950: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000960: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000970: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000980: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000990: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000009a0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000009b0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000009c0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000009d0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000009e0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000009f0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000a00: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000a10: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000a20: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000a30: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000a40: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000a50: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000a60: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000a70: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000a80: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000a90: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000aa0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000ab0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000ac0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000ad0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000ae0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000af0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000b00: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000b10: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000b20: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000b30: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000b40: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000b50: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000b60: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000b70: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000b80: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000b90: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000ba0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000bb0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000bc0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000bd0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000be0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000bf0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000c00: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000c10: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000c20: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000f70: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000f80: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000f90: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000fa0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000fb0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000fc0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000fd0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000fe0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000ff0: 0000 0000 0000 0000 0000 0000 0000 0000  ................

    at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
    at org.apache.derby.impl.store.raw.data.CachedPage.changeInstanceTo(Unknown Source)
    at org.apache.derby.impl.store.raw.data.CachedPage.setIdentity(Unknown Source)
    at org.apache.derby.impl.services.cache.ConcurrentCache.find(Unknown Source)
    at org.apache.derby.impl.store.raw.data.FileContainer.getUserPage(Unknown Source)
    at org.apache.derby.impl.store.raw.data.FileContainer.getNextHeadPage(Unknown Source)
    at org.apache.derby.impl.store.raw.data.BaseContainer.getNextPage(Unknown Source)
    at org.apache.derby.impl.store.raw.data.BaseContainerHandle.getNextPage(Unknown Source)
    at org.apache.derby.impl.store.access.conglomerate.GenericScanController.positionAtNextPage(Unknown Source)
    at org.apache.derby.impl.store.access.conglomerate.GenericScanController.fetchRows(Unknown Source)
    at org.apache.derby.impl.store.access.heap.HeapScan.fetchNextGroup(Unknown Source)
    at org.apache.derby.impl.sql.execute.BulkTableScanResultSet.reloadArray(Unknown Source)
    at org.apache.derby.impl.sql.execute.BulkTableScanResultSet.getNextRowCore(Unknown Source)
    at org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRowCore(Unknown Source)
    at org.apache.derby.impl.sql.execute.SortResultSet.getRowFromResultSet(Unknown Source)
    at org.apache.derby.impl.sql.execute.SortResultSet.getNextRowFromRS(Unknown Source)
    at org.apache.derby.impl.sql.execute.SortResultSet.loadSorter(Unknown Source)
    at org.apache.derby.impl.sql.execute.SortResultSet.openCore(Unknown Source)
    at org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.open(Unknown Source)
    at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
    at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source)
    ... 45 more

这是我用于从数据库中选择数据的方法之一:

public Vector estraiMesiEAnno(String tipoTabella) {
        String query ="";
        if(tipoTabella.equalsIgnoreCase("STORICO")){
            query = "SELECT month(data) AS MESE, YEAR(DATA) AS ANNO FROM CODSCONTRINI_STORICO GROUP BY MONTH(DATA), YEAR(DATA)";
        }else if(tipoTabella.equalsIgnoreCase("OPERATIVA")){
            query = "SELECT month(data) AS MESE, YEAR(DATA) AS ANNO FROM CODSCONTRINI GROUP BY MONTH(DATA), YEAR(DATA)";
        }

        Vector v = null; 
        int colonne = 0;
        try {
            PreparedStatement stmt = db.prepareStatement(query);     // Creo lo Statement per l'esecuzione della query
            ResultSet rs = stmt.executeQuery();   // Ottengo il ResultSet dell'esecuzione della query
            v = new Vector();
            ResultSetMetaData rsmd = rs.getMetaData();
            colonne = rsmd.getColumnCount();
            while(rs.next()) {   // Creo il vettore risultato scorrendo tutto il ResultSet
                Vector record = new Vector();
                for (int i=0; i<colonne; i++) {
                    record.add(rs.getString(i+1));
                }
                v.add(record);
            }
            rs.close();     // Chiudo il ResultSet
            stmt.close();   // Chiudo lo Statement
        } catch (Exception e) { 
            log.logStackTrace(e);
            VisualMessage.getErroreDB();
        }

        return v;
    }

1 个答案:

答案 0 :(得分:0)

数据库本身已经受到物理损坏。可悲的是,USB闪存驱动器不会永远存在。

您是否在任何地方备份数据库?