background image
<< Starting the Network Server | Shutting down the Network Server >>

Commands to invoke the Derby jar files

<< Starting the Network Server | Shutting down the Network Server >>
Derby Server and Administration Guide
16
· If you are a regular Java user but are new to Derby, set the
DERBY_HOME
environment variable, then use a
java
command to invoke the
derbyrun.jar
or
derbynet.jar
file, as shown in the following table.
Table 2.
Commands to invoke the Derby jar files
Operating
System
Command
Windows
set DERBY_HOME=C:\derby
java -jar %DERBY_HOME%\lib\derbyrun.jar server
start
or
java -jar %DERBY_HOME%\lib\derbynet.jar start
UNIX (Korn Shell)
export DERBY_HOME=/opt/derby
java -jar $DERBY_HOME/lib/derbyrun.jar server
start
or
java -jar $DERBY_HOME/lib/derbynet.jar start
To see the command syntax, invoke
derbyrun.jar server
or
derbynet.jar
with no arguments.
· If you are familiar with both the Java programming language and Derby, you have
already set
DERBY_HOME
. Set your classpath to include the Derby jar files. Then
use a
java
command to invoke the
NetworkServerControl
class directly, as
shown in the following table.
Table 3.
Commands to invoke the
NetworkServerControl
class
Operating
System
Command
Windows
%DERBY_HOME%\bin\setNetworkServerCP
java org.apache.derby.drda.NetworkServerControl
start
UNIX (Korn Shell)
$DERBY_HOME/bin/setNetworkServerCP
java org.apache.derby.drda.NetworkServerControl
start
The default system directory is the directory in which Derby was started. (See the Derby
Developer's Guide
for more information about the default system directory.)
You can specify a different host or port number when you start the Network Server by
specifying an option to the command.
· Specify a port number other than the default (1527) by using the
-p portnumber
option, as shown in the following example:
java org.apache.derby.drda.NetworkServerControl start -p 1368
· Specify a specific interface (host name or IP address) to listen on other than the
default (
localhost
) by using the
-h
option, as shown in the following example:
$DERBY_HOME/bin/startNetworkServer -h myhost -p 1368
where myhost is the host name or IP address.
Remember: Before using the
-h
option, you should run under the Java
security manager with a customized security policy and you should enable user
authentication.
By default, the Network Server will listen to requests only on the loopback address, which
means that it will only accept connections from the local host.