Running the SimpleNetworkServerSample program

To run the Derby Network Server sample program:

  1. Open a command prompt and change directories to the %DERBY_INSTALL%\demo\nserverdemo directory, where %DERBY_INSTALL% 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.
    derbytools.jar
    The Derby tools 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 exampleS:
    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
Running the SimpleNetworkServerSample program also creates the following new directories and files:
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