ObjectDB ObjectDB

Database Server

ObjectDB Server is a tool that manages ObjectDB databases in a separate dedicated process, making these databases accessible to client applications in other processes including ones on other remote machines.

The main benefits in running an ObjectDB server and using the client-server mode are:

  • The ability to access and use databases from different processes simultaneously.
  • The ability to access and use databases on remote machines over the network.

Since client-server mode carries 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 process, which is much more efficient. As a result, embedded mode should be preferred when possible. For example, if an ObjectDB database is accessed directly only by a web application, it should be embedded in that web application and run within the web server process.

Starting the ObjectDB Server

The ObjectDB Server tool is bundled in the objectdb.jar file.

You can run it from the command line as follows:

> java -cp objectdb.jar com.objectdb.Server

If objectdb.jar is not in the current directory a path to it has to be specified.

Running the server with no arguments displays the following usage message:

ObjectDB Server [version 2.8.0]
Copyright (c) 2019, 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. This can be overridden by specifying a configuration path explicitly on the command line:

> java com.objectdb.Server -conf my_objectdb.conf start

The TPC/IP port on which the server listens for new connections is also specified in the Server Configuration, but can be overridden by an explicit command line option:

> java com.objectdb.Server -port 8888 start

You can also use standard JVM arguments. For instance, you can increase the maximum JVM heap size and improve performance by using HotSpot JVM server mode:

> java -server -Xmx512m com.objectdb.Server start

Stopping and Restarting

To stop the server you can use the stop command:

> java com.objectdb.Server stop

To stop the server and then immediately start it again, use the restart command:

> java com.objectdb.Server restart

While an ObjectDB Server is running in the foreground the command window may be blocked. Therefore, you may need a new command window for the stop and restart commands.

The –conf and –port options can also be used with the stop and restart commands.

Running the Server on Unix

On 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 that script you have to edit the paths to the objectdb.jar file and to the JVM.

Consult your operating system documentation on how to run the server in the background
(for instance, using the & character at the end of the command line), on how to start the server automatically at boot time and stop it at shutdown time, and on how to restart the server periodically (for instance, using crontab).

Running the Server on Windows

On Windows you can also run the server using the server.exe application, which is located in the bin directory. For this to work the original structure of the ObjectDB directory must be preserved because server.exe tries to locate and load the objectdb.jar from the same directory in which it is 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 as well as for the server (excluding the start, stop and the restart server commands). For example:

> server.exe -client -Xmx256m -port 6666

Explicitly specified arguments override defaults, so the above run uses the following command:

> java -client -Xms32m -Xmx256m com.objectdb.Server -port 6666 start

When running, the server.exe application is represented by an icon in the Windows Tray.
Right click the icon and use the context menu to manage the server (stop, restart and start), and to exit the server application.