background image
<< Commands to invoke the Derby jar files | Obtaining system information >>

Shutting down the Network Server

<< Commands to invoke the Derby jar files | Obtaining system information >>
Derby Server and Administration Guide
17
Starting the Network Server from a Java application
Note that you should always properly shut down the Network Server after use, because
failure to do so might result in unpredictable side-effects, such as blocked ports on the
server.
There are two ways to start the Network Server from a Java application.
· You can include the following line in the
derby.properties
file:
derby.drda.startNetworkServer=true
This starts the server on the default port, 1527, listening on
localhost
(all
interfaces).
To specify a different port or a specific interface in the
derby.properties
file,
include the following lines, respectively:
derby.drda.portNumber=1110
derby.drda.host=myhost
You can also specify the
startNetworkServer
and
portNumber
properties by
using a Java command:
java -Dderby.drda.startNetworkServer=true
-Dderby.drda.portNumber=1110
-Dderby.drda.host=myhost yourApp
· You can use the NetworkServerControl API to start the Network Server from a
separate thread within a Java application:
NetworkServerControl server = new NetworkServerControl();
server.start (null);
Starting the Network Server on IPv6/IPv4 dual stack Windows machines
The following JVM properties need to be added to the command when starting the server
on IPv6/IPv4 dual stack Windows machines:
-Djava.net.preferIPv4Stack=false
-Djava.net.preferIPv6Addresses=true
Shutting down the Network Server
To shut down a Network Server, you can invoke a script, a jar file, or a class.
The scripts to shut down a Network Server are located in the
$DERBY_HOME/bin
directory.
> Important: If user authentication is enabled, you must specify a valid Derby user
name and password; if the user authentication check fails, you'll see an authentication
error and the running server remains intact. Note that Derby does not yet restrict the
shutdown privilege to specific users: the server can be shut down by any user on the
server machine who presents valid credentials.
· To shut down the Network Server by using the scripts provided for Windows
systems, use:
stopNetworkServer.bat [-h hostname] [-p portnumber] [-user username]
[-password password]
· To shut down the Network Server by using the scripts provided for UNIX systems,
use:
stopNetworkServer [-h hostname] [-p portnumber] [-user username]
[-password password]