Updating Db4o File Format

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:

c#: 

Db4oFactory.Configure().AllowVersionUpdates(true)

VB: 

Db4oFactory.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:


UpdateExample.cs
01/* Copyright (C) 2004 - 2007 db4objects Inc. http://www.db4o.com */ 02using Db4objects.Db4o; 03 04namespace Db4objects.Db4odoc.VersionUpdate 05{ 06 class UpdateExample 07 { 08 public static void Main(string[] args) 09 { 10 Db4oFactory.Configure().AllowVersionUpdates(true); 11 IObjectContainer objectContainer = Db4oFactory.OpenFile(args[0]); 12 objectContainer.Close(); 13 System.Console.WriteLine("The database is ready for the version " + Db4o.Db4oVersion.NAME); 14 } 15 } 16}


UpdateExample.vb
01' Copyright (C) 2007 db4objects Inc. http:'www.db4o.com 02 03Imports Db4objects.Db4o 04 05Namespace Db4objects.Db4odoc.VersionUpdate 06 Public Class UpdateExample 07 08 Public Shared Sub Main(ByVal args As String()) 09 Db4oFactory.Configure().AllowVersionUpdates(True) 10 Dim objectContainer As IObjectContainer = Db4oFactory.OpenFile(args(0)) 11 objectContainer.Close() 12 System.Console.WriteLine("The database is ready for the version " + Db4o.Db4oVersion.NAME) 13 End Sub 14 End Class 15End Namespace

Recommendations for upgrading: