http://bryanpendleton.blogspot.com/2009/09/whats-in-those-files-in-my-derby-db.html

Derby records information about each conglomerate in its system catalogs, so you can simply
run a query to find out which conglomerate is used by which table:

 select c.conglomeratenumber, c.isindex, t.tablename 
        from sys.sysconglomerates c, 
             sys.systables t 
        where c.tableid=t.tableid;

So, for example, if you're wondering what is being stored in file c850.dat, you can
simply convert 850-hex to 2128-decimal, and then run:

 select c.conglomeratenumber, c.isindex, t.tablename 
        from sys.sysconglomerates c, 
             sys.systables t 
       where c.tableid=t.tableid 
         and c.conglomeratenumber=2128;

Or, if you're wondering which files are used by table STASH_ITEM_V7:

 select c.conglomeratenumber, c.isindex, t.tablename 
        from sys.sysconglomerates c, 
             sys.systables t 
       where c.tableid=t.tableid 
         and t.tablename='STASH_ITEM_V7';

CONGLOMERATE	ISINDEX		TABLENAME
1200		false		STASH_ITEM_V7
1217		true		STASH_ITEM_V7

Convert the Conglomerate number to hexadecimal (it is in decimal),
add a 'c' in front and a '.dat' in the end to get the derby filename.
The file can be found in the Derby DB, subdirectory seg0

For STASH_ITEM_V7 this results in

c4b0.dat for the items
c4c1.dat for the index


select c.conglomeratenumber, c.isindex, t.tablename 
        from sys.sysconglomerates c, 
             sys.systables t 
       where c.tableid=t.tableid 
         and t.tablename='STASH_ITEM_V8';

CONGLOMERATE	ISINDEX		TABLENAME
363024	false	STASH_ITEM_V8
363041	true	STASH_ITEM_V8

c58a10.dat
c58a21.dat

===============================================================================

https://givemethechills.com/recovering-a-corrupted-embedded-apache-derby-database-after-an-error-xj040-or-if-you-get-an-error-xsdg2/

SELECT schemaname || '.' || tablename as TableName,SYSCS_UTIL.SYSCS_CHECK_TABLE(schemaname, tablename) AS OK FROM sys.sysschemas s, sys.systables t WHERE s.schemaid = t.schemaid   and t.tabletype = 'T'   ;


https://issues.apache.org/jira/browse/DERBY-5195

https://issues.apache.org/jira/secure/attachment/12476468/ControlFileReader.java
https://issues.apache.org/jira/secure/attachment/12774638/LogFileReader.java
