Hello,
There are two MDB files. One of them has corrupted index data (testdb_corrupted_index.mdb) and another one (testdb.mdb) is recovered by using the MS Access recovery option.
Here is a test code:
private static void testCorruptedIndex() throws Exception {
// Database db = Database.open(new File(
// "testdb.mdb"));
Database db = Database.open(new File(
"testdb_corrupted_index.mdb"));
Table t = db.getTable("products");
List<Index> indexes = t.getIndexes();
IndexCursor indexCursor = IndexCursor.createCursor(t, indexes.get(1));
indexCursor.findClosestRowByEntry("Printer");
Map map = indexCursor.getCurrentRow();
System.out.println(map);
db.close();
}
For “testdb.mdb” the test returns the correct row, but for “testdb_corrupted_index.mdb” it throws an exception.
So I have a question: is it possible to programmatically determine if an MDB file is corrupted (or even if a specific table or a specific index is corrupted) and it needs to be recovered. Something like checkCorrupted() method. It would be useful to prevent getting incorrect data.
Test files are attached.
this is possible to an extent (obviously there are all kinds of possible corruption). it would probably be a fairly expensive operation as it would need to look through all the data in the table/index.