Running the SimpleNetworkServerSample program

To run the Derby Network Server sample program, follow these steps.

  1. Open a command prompt and change directories to the %DERBY_HOME%\demo\nserverdemo directory, where %DERBY_HOME% is the directory where you installed Derby.
  2. Set the classpath to include the current directory (".") and the following jar files:
    derbynet.jar
    The Network Server jar file. It must be in your CLASSPATH because you start the Network Server in this program.
    derby.jar
    The database engine jar file.
  3. Test the CLASSPATH settings by running the following Java command:
    java org.apache.derby.tools.sysinfo
    This command displays the Derby jar files that are in the classpath.
  4. After you set up your environment correctly, run the SimpleNetworkServerSample program from the same directory:
    java SimpleNetworkServerSample
    If the program runs successfully, you will receive output that is similar to that shown in the following example:
    Starting Network Server
    Testing if Network Server is up and running!
    Derby Network Server now running
    Got an embedded connection.
    Testing embedded connection by executing a sample query
    number of rows in sys.systables = 16
    While my app is busy with embedded work, ij might connect like this:
    
            $ java -Dij.user=me -Dij.password=pw -Dij.protocol=
    			jdbc:derby:\\localhost:1527\ org.apache.derby.tools.ij
            ij> connect 'NSSimpleDB';
    
    Clients can continue to connect:
    Press [Enter] to stop Server

Do not press Enter at this time. Leave the server running while you run the SimpleNetworkClientSample program.

Running the SimpleNetworkServerSample program also creates the following new directory and file:
NSSimpleDB
This directory makes up the NSSimpleDB database.
derby.log
This log file contains Derby progress and error messages.
Related concepts
Overview of the SimpleNetworkServerSample program
Connecting a client to the Network Server with the SimpleNetworkClientSample program
Related tasks
Running the SimpleNetworkClientSample program