How can I run the apache derby program jar file?
I have a Java application that uses Apache Derby. Using the Eclipse Export option, I exported it as a JAR file. When I start Eclipse and the server is connected to port 1527, the JAR runs correctly.
However, when closing eclipse (and the server is not connected to 1527) while executing the jar, I get this error
java.sql.SQLNonTransientConnectionException: java.net.ConnectException: Error connecting to localhost server on port 1527 with message Connection refused.
This is clear. But I want to distribute the JAR. So, is there a way to start the server programmatically when the JAR is running?
source to share
You can start NetworkServer programmatically :
NetworkServerControl serverControl = new NetworkServerControl(InetAddress.getByName("myhost"),1621)
serverControl.shutdown();
source to share
You need to start the server programmatically.
How this is done is described in the manual:
http://db.apache.org/derby/docs/10.8/adminguide/tadminconfig814963.html
source to share