Database Server
The ObjectDB Server is a tool that manages ObjectDB databases in a separate, dedicated process. This makes the databases accessible to client applications in other processes, including those on remote computers.
The main benefits of running an ObjectDB server in client-server mode are:
- The ability to access and use databases from different processes simultaneously.
- The ability to access and use databases on remote computers over the network.
Because client-server mode has the overhead of TCP/IP communication between the client and the server, it is usually slower than embedded mode. In embedded mode, ObjectDB is integrated as a library and runs within the application's process, which is more efficient. As a result, you should use embedded mode when possible. For example, if an ObjectDB database is accessed only by a single web application, it should be embedded in that application and run within the web server's process.
Starting the ObjectDB server
The ObjectDB Server tool is bundled in the objectdb.jar file.
Run it from the command line as follows:
$ java -cp objectdb.jar com.objectdb.Server
If objectdb.jar is not in the current directory, you must specify a path to it.
Running the server with no arguments displays the following usage message:
ObjectDB Server [version 2.9.4] Copyright (c) 2025, ObjectDB Software, All rights reserved. Usage: java com.objectdb.Server [options] start | stop | restart options include: -conf <path> : specify a configuration file explicitly -port <port> : override configuration's server port -silent : avoid printing messages to the standard output -console : avoid showing the server tray icon
To start the server, use the start command-line argument:
$ java com.objectdb.Server start
The server configuration is loaded automatically, as explained in Chapter 6. You can override this by specifying a configuration path on the command line:
$ java com.objectdb.Server -conf my_objectdb.conf start
The TCP/IP port on which the server listens for new connections is also specified in the server configuration, but you can override it with a command-line option:
$ java com.objectdb.Server -port 8888 start
You can also use standard JVM arguments. For example, you can increase the maximum JVM heap size and improve performance by using the HotSpot JVM server mode:
$ java -server -Xmx512m com.objectdb.Server start
Stopping and restarting
To stop the server, use the stop command:
$ java com.objectdb.Server stop
To stop the server and immediately start it again, use the restart command:
$ java com.objectdb.Server restart
While the ObjectDB Server is running in the foreground, the command window might be blocked. Therefore, you might need a new command window for the stop and restart commands.
You can also use the -conf and -port options with the stop and restart commands.
Running the server on Linux/Unix
On Linux/Unix, you can use a shell script to run and manage the server. A sample script, server.sh, is included in the bin directory. To use this script, you must edit the paths to the objectdb.jar file and the JVM.
Consult your operating system's documentation for instructions on how to:
- Run the server in the background
(for example, by using the&character at the end of the command line). - Start the server automatically at boot time and stop it at shutdown.
- Restart the server periodically (for example, by using
crontab).
Running the server on Windows
On Windows, you can also run the server by using the server.exe application, which is in the bin directory. For this to work, the original ObjectDB directory structure must be preserved, because server.exe tries to locate and load objectdb.jar from the directory where it was started.
By default, server.exe starts the server using the following command:
$ java -server -Xms32m -Xmx512m com.objectdb.Server start
When running server.exe, you can specify arguments for the JVM and the server (excluding the start, stop, and restart commands). For example:
$ server.exe -client -Xmx256m -port 6666
Specified arguments override the defaults, so the previous example runs the following command:
$ java -client -Xms32m -Xmx256m com.objectdb.Server -port 6666 start
When running, the server.exe application appears as an icon in the Windows notification area (system tray). Right-click the icon and use the context menu to manage the server (stop, restart, and start) or to exit the server application.