How to start an embedded server from an application

In one thread, the embedding application starts the local JDBC driver for its own access.

/* loading the client driver boots the client driver only*/
Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();
Connection conn = DriverManager.getConnection(
    "jdbc:derby:sample");

In another thread, the same application starts the server framework to allow remote access. Starting the server framework from within the application allows both the server and the application to run in the same JVM.

Related concepts
Connectivity configurations
Multiple-client features available in Derby
The Derby Network Server
Embedded servers
Related reference
Embedded server example