In one thread, the embedding application starts the local JDBC driver for its own access.
/* If you are running on JDK 1.6 or higher, then you do not need to invoke Class.forName(). In that environment, the EmbeddedDriver loads automatically. */ 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.