You are here: Advanced Features > Defragment > Defragmentation Configuration > Database Configuration

Database Configuration

Perhaps you're using low level configuration settings which are file-related. In such cases it's recommended to use the database configuration for the defragmentation process. Especially settings like string-encoding and block-size need to be configured properly for the defragmentation.

DefragmentConfig config = new DefragmentConfig("database.db4o");
// It's best to use the very same configuration you use for the regular database
IEmbeddedConfiguration configuration = Db4oEmbedded.NewConfiguration();
config.Db4oConfig(configuration);

Defragment.Defrag(config);
DefragmentationConfigurationExamples.cs: Use the database-configuration
Dim config As New DefragmentConfig("database.db4o")
' It's best to use the very same configuration you use for the regular database
Dim configuration As IEmbeddedConfiguration = Db4oEmbedded.NewConfiguration()
config.Db4oConfig(configuration)

Defragment.Defrag(config)
DefragmentationConfigurationExamples.vb: Use the database-configuration