Package com.db4o
Class Db4o
- java.lang.Object
- 
- com.db4o.Db4o
 
- 
 public class Db4o extends java.lang.ObjectDeprecated.factory class to start db4o database engines.
 This class provides static methods to
 - open single-user databasesopenFile(String)
 - open db4o serversopenServer(String, int)
 - connect to db4o serversopenClient(String, int, String, String)
 - provide access to the global configuration contextconfigure()
 - print the version number of this db4o versionmain(String[])- See Also:
- ExtDb4o for extended functionality.
 
- 
- 
Constructor SummaryConstructors Constructor Description Db4o()Deprecated.
 - 
Method SummaryAll Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static ConfigurationcloneConfiguration()Deprecated.use explicit configuration viaDb4oEmbedded.newConfiguration()insteadstatic Configurationconfigure()Deprecated.use explicit configuration viaDb4oEmbedded.newConfiguration()insteadstatic voidmain(java.lang.String[] args)Deprecated.UseDb4oVersion.NAMEinstead.static ConfigurationnewConfiguration()Deprecated.UseDb4oEmbedded.newConfiguration()instead.static ObjectContaineropenClient(Configuration config, java.lang.String hostName, int port, java.lang.String user, java.lang.String password)Deprecated.See theDb4oClientServerclass in db4o client server library for methods to open db4o servers and db4o clients.static ObjectContaineropenClient(java.lang.String hostName, int port, java.lang.String user, java.lang.String password)Deprecated.See theDb4oClientServerclass in db4o client server library for methods to open db4o servers and db4o clients.static ObjectContaineropenFile(Configuration config, java.lang.String databaseFileName)Deprecated.static ObjectContaineropenFile(java.lang.String databaseFileName)Deprecated.static ObjectServeropenServer(Configuration config, java.lang.String databaseFileName, int port)Deprecated.See the Db4oClientServer class in db4o client server library for methods to open db4o servers and db4o clients.static ObjectServeropenServer(java.lang.String databaseFileName, int port)Deprecated.See theDb4oClientServerclass in db4o client server library for methods to open db4o servers and db4o clients.static java.lang.Stringversion()Deprecated.Since 8.1.
 
- 
- 
- 
Method Detail- 
mainpublic static void main(java.lang.String[] args) Deprecated.UseDb4oVersion.NAMEinstead.prints the version name of this db4o version toSystem.out.
 - 
configurepublic static Configuration configure() Deprecated.use explicit configuration viaDb4oEmbedded.newConfiguration()insteadreturns the global db4oConfigurationcontext for the running VM session.
 TheConfigurationcan be overridden in eachObjectContainer.- Returns:
- the global configurationcontext
 
 - 
newConfigurationpublic static Configuration newConfiguration() Deprecated.UseDb4oEmbedded.newConfiguration()instead.Creates a freshConfigurationinstance.- Returns:
- a fresh, independent configuration with all options set to their default values
 
 - 
cloneConfigurationpublic static Configuration cloneConfiguration() Deprecated.use explicit configuration viaDb4oEmbedded.newConfiguration()insteadCreates a clone of the global db4oConfiguration.- Returns:
- a fresh configuration with all option values set to the values currently configured for the global db4o configuration context
 
 - 
openClientpublic static ObjectContainer openClient(java.lang.String hostName, int port, java.lang.String user, java.lang.String password) throws Db4oIOException, OldFormatException, InvalidPasswordException Deprecated.See theDb4oClientServerclass in db4o client server library for methods to open db4o servers and db4o clients.Operates just likeopenClient(Configuration, String, int, String, String), but uses the global db4oConfigurationcontext. opens anObjectContainerclient and connects it to the specified named server and port.
 The server needs toallow accessfor the specified user and password.
 A clientObjectContainercan be cast toExtClientto use extendedExtObjectContainerandExtClientmethods.- Parameters:
- hostName- the host name
- port- the port the server is using
- user- the user name
- password- the user password
- Returns:
- an open ObjectContainer
- Throws:
- Db4oIOException- I/O operation failed or was unexpectedly interrupted.
- OldFormatException- open operation failed because the database file is in old format and- Configuration.allowVersionUpdates(boolean)is set to false.
- InvalidPasswordException- password supplied for the connection is invalid.
- See Also:
- ObjectServer.grantAccess(java.lang.String, java.lang.String)
 
 - 
openClientpublic static ObjectContainer openClient(Configuration config, java.lang.String hostName, int port, java.lang.String user, java.lang.String password) throws Db4oIOException, OldFormatException, InvalidPasswordException Deprecated.See theDb4oClientServerclass in db4o client server library for methods to open db4o servers and db4o clients.opens anObjectContainerclient and connects it to the specified named server and port.
 The server needs toallow accessfor the specified user and password.
 A clientObjectContainercan be cast toExtClientto use extendedExtObjectContainerandExtClientmethods.- Parameters:
- config- a custom- Configurationinstance to be obtained via- Db4oEmbedded.newConfiguration()
- hostName- the host name
- port- the port the server is using
- user- the user name
- password- the user password
- Returns:
- an open ObjectContainer
- Throws:
- Db4oIOException- I/O operation failed or was unexpectedly interrupted.
- OldFormatException- open operation failed because the database file is in old format and- Configuration.allowVersionUpdates(boolean)is set to false.
- InvalidPasswordException- password supplied for the connection is invalid.
- See Also:
- ObjectServer.grantAccess(java.lang.String, java.lang.String)
 
 - 
openFilepublic static final ObjectContainer openFile(java.lang.String databaseFileName) throws Db4oIOException, DatabaseFileLockedException, IncompatibleFileFormatException, OldFormatException, DatabaseReadOnlyException Deprecated.Operates just likeDb4oEmbedded#openFile(Configuration, String), but uses the global db4oConfigurationcontext. opens anObjectContaineron the specified database file for local use.
 A database file can only be opened once, subsequent attempts to open anotherObjectContaineragainst the same file will result in aDatabaseFileLockedException.
 Database files can only be accessed for readwrite access from one process (one VM) at one time. All versions except for db4o mobile edition use an internal mechanism to lock the database file for other processes.- Parameters:
- 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- runtime- configurationis not compatible with the configuration of the database file.
- OldFormatException- open operation failed because the database file is in old format and- Configuration.allowVersionUpdates(boolean)is set to false.
- DatabaseReadOnlyException- database was configured as read-only.
- See Also:
- Configuration.readOnly(boolean),- Configuration.encrypt(boolean),- Configuration.password(java.lang.String)
 
 - 
openFilepublic static final ObjectContainer openFile(Configuration config, java.lang.String databaseFileName) throws Db4oIOException, DatabaseFileLockedException, IncompatibleFileFormatException, OldFormatException, DatabaseReadOnlyException Deprecated.opens anObjectContaineron the specified database file for local use.
 A database file can only be opened once, subsequent attempts to open anotherObjectContaineragainst the same file will result in aDatabaseFileLockedException.
 Database files can only be accessed for readwrite access from one process (one VM) at a time. All versions except for db4o mobile edition use an internal mechanism to lock the database file for other processes.- Parameters:
- config- a custom- Configurationinstance to be obtained via- Db4oEmbedded.newConfiguration()
- 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- runtime- configurationis not compatible with the configuration of the database file.
- OldFormatException- open operation failed because the database file is in old format and- Configuration.allowVersionUpdates(boolean)is set to false.
- DatabaseReadOnlyException- database was configured as read-only.
- See Also:
- Configuration.readOnly(boolean),- Configuration.encrypt(boolean),- Configuration.password(java.lang.String)
 
 - 
openServerpublic static final ObjectServer openServer(java.lang.String databaseFileName, int port) throws Db4oIOException, IncompatibleFileFormatException, OldFormatException, DatabaseFileLockedException, DatabaseReadOnlyException Deprecated.See theDb4oClientServerclass in db4o client server library for methods to open db4o servers and db4o clients.Operates just likeopenServer(Configuration, String, int), but uses the global db4oConfigurationcontext. opens anObjectServeron the specified database file and port.
 If the server does not need to listen on a port because it will only be used in embedded mode withObjectServer.openClient(), specify '0' as the port number.- Parameters:
- databaseFileName- an absolute or relative path to the database file
- port- the port to be used, or 0, if the server should not open a port, because it will only be used with- ObjectServer.openClient(). Specify a value < 0 if an arbitrary free port should be chosen - see- ExtObjectServer.port().
- Returns:
- an ObjectServerlistening on the specified port.
- Throws:
- Db4oIOException- I/O operation failed or was unexpectedly interrupted.
- DatabaseFileLockedException- the required database file is locked by another process.
- IncompatibleFileFormatException- runtime- configurationis not compatible with the configuration of the database file.
- OldFormatException- open operation failed because the database file is in old format and- Configuration.allowVersionUpdates(boolean)is set to false.
- DatabaseReadOnlyException- database was configured as read-only.
- See Also:
- Configuration.readOnly(boolean),- Configuration.encrypt(boolean),- Configuration.password(java.lang.String)
 
 - 
openServerpublic static final ObjectServer openServer(Configuration config, java.lang.String databaseFileName, int port) throws Db4oIOException, IncompatibleFileFormatException, OldFormatException, DatabaseFileLockedException, DatabaseReadOnlyException Deprecated.See the Db4oClientServer class in db4o client server library for methods to open db4o servers and db4o clients.opens anObjectServeron the specified database file and port.
 If the server does not need to listen on a port because it will only be used in embedded mode withObjectServer.openClient(), specify '0' as the port number.- Parameters:
- config- a custom- Configurationinstance to be obtained via- Db4oEmbedded.newConfiguration()
- databaseFileName- an absolute or relative path to the database file
- port- the port to be used, or 0, if the server should not open a port, because it will only be used with- ObjectServer.openClient(). Specify a value < 0 if an arbitrary free port should be chosen - see- ExtObjectServer.port().
- Returns:
- an ObjectServerlistening on the specified port.
- Throws:
- Db4oIOException- I/O operation failed or was unexpectedly interrupted.
- DatabaseFileLockedException- the required database file is locked by another process.
- IncompatibleFileFormatException- runtime- configurationis not compatible with the configuration of the database file.
- OldFormatException- open operation failed because the database file is in old format and- Configuration.allowVersionUpdates(boolean)is set to false.
- DatabaseReadOnlyException- database was configured as read-only.
- See Also:
- Configuration.readOnly(boolean),- Configuration.encrypt(boolean),- Configuration.password(java.lang.String)
 
 - 
versionpublic static final java.lang.String version() Deprecated.Since 8.1. UseDb4oVersion.NAMEinstead.returns the version name of the used db4o version.- Returns:
- version information as a String.
 
 
- 
 
-