apache > db
Apache DB Project
 
Font size:      

Overview

Overview

The Derby Network Server can run as a stand-alone server, with Derby as an embedded part of the application. It can also be managed remotely from a Web server through a servlet interface. This chapter explains how to manage the Network Server using shell scripts, the command line, or the Network Server API. See "Managing the Derby Network Server Remotely" for information about starting and shutting down the Network Server using the servlet interface.

You start the Derby Network Server using the command line or using the Derby Server API. (Derby provides scripts for you to use to start the server from the command line.) Before starting the server, you will probably set certain Derby and Network Server properties.

The Network Server and JVMs

The Derby Network Server is compatible with Java(TM) 2 Platform, Standard Edition, v 1.3.1 (J2SE) and above.

Setting the Class Path

Before starting the server, be sure the jar files for the Network Server and Derby libraries are in your class path. For instance, if you have installed Derby under C:\derby, add C:\derby\lib\derby.jar and C:\derby\lib\derbynet.jar to the class path. Also add the libraries for any Java classes used in your databases.

Derby provides script files for setting the class path, located in $DERBY_INSTALL\frameworks\NetworkServer\bin.

  • setNetworkClientCP.bat (Windows)
  • setNetworkClientCP.ksh (UNIX)
  • setNetworkServerCP.bat (Windows)
  • setNetworkServerCP.ksh (UNIX)

See Getting Started with Derby for more information on setting class path.

Using the NetworkServerControl API

If you are using the API, you need to create a instance of the NetworkServerControl class first.

There are two constructor methods for the NetworkServerControl class:

  • NetworkServerControl()

    Creates an instance which listens on the port set by the derby.drda.portNumberProperty or the default port (1527) if the property is not set. It will also listen on the host set by the derby.drda.host property or the loopback address if the property is not set. The default constructor disallows remote connections. It is equivalent to calling NetworkServerControl(InetAddress.getByName("localhost"),1527) if no properties are set.

  • NetworkServerControl(InetAddress address, int portNumber)

    Creates an instance which listens on the specified portNumber on the specified address. The InetAddress will be passed to ServerSocket. NULL is an invalid address value. The following examples show how you might allow Network Server to accept connections from other hosts:

    //accepts connections from other hosts on an IPv4 system
    NetworkServerControl serverControl = new NetworkServerControl
            (InetAddress.getByName("0.0.0.0"),1527) 
    
    //accepts connections from other hosts on an IPV6 system
    NetworkServerControl serverControl = new NetworkServerControl
            (InetAddress.getByName("::"),1527) 
    
    Note:
    Before enabling connections from other systems, ensure that you are running under security manager.

Previous Page
Next Page
Table of Contents
Index