The SimpleNetworkServerSample program starts the
Derby Network
Server, as well as the embedded driver, and waits for clients to connect. The
program performs the following tasks.
- Starts the Derby Network Server by using a property and also loads the embedded driver
- Determines if the Network Server is running
- Creates the NSSimpleDB database if it is not already
created
- Obtains an embedded database connection
- Tests the database connection by executing a sample query
- Allows client connections to connect to the server until you decide to
stop the server and exit the program
- Closes the connection
- Shuts down the Network Server before exiting the program
To run the sample program, use the following files in
the
%JAVA_HOME%\demo\db\programs\nserverdemo\ directory:
- The source file: SimpleNetworkServerSample.java
- The compiled class file: SimpleNetworkServerSample.class
You must have installed the Demos and Samples for the JDK. See
"Installing Java DB" in Getting Started with Java DB for
details.