# Network Server sample programs for embedded and client connections

This Derby Network Server sample program demonstrates how to obtain an embedded connection and client connections to the same database by using the Network Server. This program shows how to use either the `DriverManager` or a DataSource to obtain client connections.

For a database to be consistent, only one JVM can access it at a time. The embedded driver is loaded when the Network Server is started. The JVM that starts the Network Server can obtain an embedded connection to the same database that the Network Server is accessing to serve clients from other JVMs. This solution provides the performance benefits of the embedded driver and also allows client connections from other JVMs to connect to the same database.

- Overview of the SimpleNetworkServerSample program
  The SimpleNetworkServerSample program starts the Derby Network Server, as well as the embedded driver, and waits for clients to connect.
- Running the SimpleNetworkServerSample program
  To run the Derby Network Server sample program, follow these steps.
- Connecting a client to the Network Server with the SimpleNetworkClientSample program
  The SimpleNetworkClientSample program is a client program that interacts with the Derby Network Server from another JVM.
- Running the SimpleNetworkClientSample program
  To connect to the Network Server that has been started with the SimpleNetworkServerSample program, follow these steps.

Parent topic: Derby Network Server sample programs
Related reference
The NsSample sample program