Library Version 12.1.6.2

Starting the Server
Prev | Chapter 2. Berkeley DB Server | Next

## Starting the Server

On UNIX/POSIX systems, a shell script `start_server.sh` is installed under the `bin` directory if `--enable-server` is specified to the build configuration. This script sets up the proper classpath and JVM options, and starts the server program.

On Windows systems, no batch script is provided because the place of the `db.jar` depends on the build configuration. To start a server, you need to do the following:

1. Copy `bdb.properties` and `log4j.xml` from `lang/thrift/server` to your current directory.

2. Include the `db.jar` and all jar files under `lang/thrift/jars` to the classpath.

3. Set the `java.library.path` JVM option to point to the directory where native Berkeley DB libraries are placed.

4. Run the `com.sleepycat.server.BdbServer` program.

For example, if the native libraries and `db.jar` are placed under `build_windows/Win32/Release`, a batch script placed under it would look like:

    set THRIFT_HOME=..\..\..\lang\thrift

    copy %THRIFT_HOME%\server\bdb.properties .
    copy %THRIFT_HOME%\server\log4j.xml .

    set CLASSPATH=.;%THRIFT_HOME%\jars\slf4j-api.jar
    set CLASSPATH=%CLASSPATH%;%THRIFT_HOME%\jars\slf4j-log4j12.jar
    set CLASSPATH=%CLASSPATH%;%THRIFT_HOME%\jars\log4j.jar
    set CLASSPATH=%CLASSPATH%;%THRIFT_HOME%\jars\libthrift.jar
    set CLASSPATH=%CLASSPATH%;%THRIFT_HOME%\jars\db_thrift_interface.jar
    set CLASSPATH=%CLASSPATH%;%THRIFT_HOME%\jars\db_thrift_server.jar
    set CLASSPATH=%CLASSPATH%;db.jar

    java -Djava.library.path=. com.sleepycat.server.BdbServer

The `BdbServer` supports the following options:

- -v

  Print the version of the server program.

- -h

  Print the help information of the server program.

- -config-file

  Specify the configuration file for the server program.

- -log-config

  Specify the log4j XML configuration file for the server program.

Prev | Up | Next
Chapter 2. Berkeley DB Server | Home | Stopping the server