Package com.db4o
Class Db4oEmbedded
- java.lang.Object
-
- com.db4o.Db4oEmbedded
-
public class Db4oEmbedded extends java.lang.Object
Factory class to open db4o instances in embedded mode.
For client server scenarious please use the com.db4o.cs.Db4oClientServer factory from the db4o-cs-java.jar for methods to open db4o servers and db4o clients.- Since:
- 7.5
-
-
Constructor Summary
Constructors Constructor Description Db4oEmbedded()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static EmbeddedConfiguration
newConfiguration()
Creates a freshEmbeddedConfiguration
instance.static EmbeddedObjectContainer
openFile(EmbeddedConfiguration config, java.lang.String databaseFileName)
Opens anObjectContainer
on the specified database file for local use.static EmbeddedObjectContainer
openFile(java.lang.String databaseFileName)
Same (from java) as callingopenFile(EmbeddedConfiguration, String)
with a fresh configuration (newConfiguration()
).
-
-
-
Method Detail
-
newConfiguration
public static EmbeddedConfiguration newConfiguration()
Creates a freshEmbeddedConfiguration
instance.- Returns:
- a fresh, independent configuration with all options set to their default values
-
openFile
public static final EmbeddedObjectContainer openFile(EmbeddedConfiguration config, java.lang.String databaseFileName) throws Db4oIOException, DatabaseFileLockedException, IncompatibleFileFormatException, OldFormatException, DatabaseReadOnlyException
Opens anObjectContainer
on the specified database file for local use.
Database files can only be accessed for access from one process at one time. Subsequent attempts to open the same file will result in aDatabaseFileLockedException
.
For multiple object containers against the same database use theObjectContainer
.ext()
.openSession()
() method. Or use the client server mode from the db4o-cs-java.jar- Parameters:
config
- aEmbeddedConfiguration
instance to be obtained vianewConfiguration()
databaseFileName
- an absolute or relative path to the database file- Returns:
- an open
ObjectContainer
- Throws:
Db4oIOException
- I/O operation failed or was unexpectedly interrupted.DatabaseFileLockedException
- the required database file is locked by another process.IncompatibleFileFormatException
- runtimeconfiguration
is not compatible with the configuration of the database file.OldFormatException
- open operation failed because the database file is in old format andCommonConfiguration.allowVersionUpdates(boolean)
is set to false.DatabaseReadOnlyException
- database was configured as read-only.
-
openFile
public static final EmbeddedObjectContainer openFile(java.lang.String databaseFileName) throws Db4oIOException, DatabaseFileLockedException, IncompatibleFileFormatException, OldFormatException, DatabaseReadOnlyException
Same (from java) as callingopenFile(EmbeddedConfiguration, String)
with a fresh configuration (newConfiguration()
).- Parameters:
databaseFileName
- an absolute or relative path to the database file- Throws:
Db4oIOException
DatabaseFileLockedException
IncompatibleFileFormatException
OldFormatException
DatabaseReadOnlyException
- See Also:
openFile(EmbeddedConfiguration, String)
-
-