I am trying to create a Derby database server application using Java. So far i have managed to create client end applications that connect to the derby database which can be accessed from the server I started using derby cmd commands. What i need to make is a java application which, when ran, will start the derby database server. So far all I have come across is this
NetworkServerControl serverControl = new NetworkServerControl(InetAddress.getByName("myhost"),1621);
serverControl.start();
Every time I run this code nothing happens. I am new to Derby and I really need to figure this out for my application. Please don't mention Apache Derby or Oracle derby documentations as i have gone through them and failed to understand. A simple precise solution will be highly appreciated!
P.S. I have added the derbynet.jar file to my project.
To start derby server from same VM (derby 10.11.1.1) as your application:
download bin package: http://ftp.ps.pl/pub/apache//db/derby/db-derby-10.11.1.1/db-derby-10.11.1.1-bin.zip
extract, and go to db-derby-10.11.1.1-bin\lib
copy all jars from lib to your lib folder in your app, add to dependencies.
then in your app execute this:
String[] args = {"start"};
// for other port;
// String[] args = {"start","-p","1088"};
org.apache.derby.drda.NetworkServerControl.main( args);
If you would like to start separate process then, use:
Runtime.getRuntime().exec(cmdarray)
where cmdarray is your path to executable and parameters to run it.