Does anybody are conscious of a method to shrink/compact a db4o database?
Exactly what do you mean by compact/shrink? Make a current database more compact? Or would you like to compress the database?
Among roles with this is defragmentation. This releases unused space within the database. Whenever you remove objects, the database does not shrink. Rather the area is marked as free for brand new objects. However overtime having a the manipulation from the database the file get fragmented. So defragmentation returns unused space within the database.
Whenever you store lots of strings, you should look at using UTF8 encoding rather than default full unicode. This protects much space, just because a now a personality uses just one byte.
EmbeddedConfiguration config = Db4oEmbedded.newConfiguration(); config.common().stringEncoding(StringEncodings.utf8()); ObjectContainer database = Db4oEmbedded.openFile(config,"database.db4o");
Observe that you can't change this setting for existing databases! You have to defragment the database to be able to alter the string encoding.
To compress the database you could utilize a blending storage-implementation. However I'm not sure any available implementation which performs this.