To verify that the Derby Network Server is currently running, use the ping command.
You can use the ping command in the following ways:
private static boolean isServerStarted(NetworkServerControl server, int ntries) {
for (int i = 1; i <= ntries; i ++) {
try {
Thread.sleep(500);
server.ping();
return true;
} catch (Exception e) {
if (i == ntries) {
return false;
}
}
}
return false;
}