The db4o database file format is a subject to change to
allow progress for performance and additional features.
db4o does not support downgrades back to previous versions of database files.
In order to prevent accidental upgrades when using different db4o versions or
ObjectManager, db4o does not upgrade databases by default.
Database upgrading can be turned on with the following configuration switch:
Java:
Db4o.configure().allowVersionUpdates(true)
Please note that, once the database file version is updated, there is no way to
get back to the older version of the database file
If a database file is opened successfully with the new db4o version, the
upgrade of the file will take place automatically. You can simply upgrade
database files by opening and closing a db4o database once with code like the
following:
/* Copyright (C) 2007 db4objects Inc. http://www.db4o.com */
02
03
package com.db4odoc.versionupdate;
04
05
import com.db4o.Db4o;
06
import com.db4o.ObjectContainer;
07
08
public class UpdateExample {
09
10
public static void main(String[] args) {
11
Db4o.configure().allowVersionUpdates(true);
12
ObjectContainer objectContainer = Db4o.openFile(args[0]);
13
objectContainer.close();
14
System.out.println("The database is ready for the version " + Db4o.version());
15
}
16
17
}