14. Configuration


db4o provides a wide range of configuration methods to request special behaviour. For a complete list of all available methods see the API documentation for thecom.db4o.config and com.db4o.cs.config packages.   
A more complete description of Configuration usage and scope can also be obtained from the Reference  documentation.

Some hints around using configuration calls:


    14.1. Scope

    Configuration should be created and passed to an opening ObjectContainer or ObjectServer:
    EmbeddedConfiguration config = Db4oEmbedded.newConfiguration();

    ServerConfiguration serverConfig = Db4oClientServer.newServerConfiguration();

    ClientConfiguration clientConfig = Db4oClientServer.newClientConfiguration();



    Appropriate configuration should be submitted when an ObjectContainer  ObjectServer is opened:
    Db4oEmbedded.openFile(config, filename)

    Db4oClientServer.openServer(serverConfig, filename, PORT)

    Db4oClientServer.openClient(clientConfig, HOST, PORT, USER, PASS);



    A separate configuration instance should be created for each new ObjectContainer  ObjectServer  It is recommended to use a factory method with all the necessary settings.



    14.2. Calling Methods

    Configurations that influence the database file format will have to take place, before a database is created, before the first #openXXX() call. Some examples:
    EmbeddedConfiguration conf = Db4oEmbedded.newConfiguration();
    conf.blockSize(8);
    conf.stringEncoding(new MyStringEncoding());



    Configuration settings are not stored in db4o database files. Accordingly the same configuration has to be submitted  every time an  ObjectContainer  ObjectServer  is opened.