apache > db
Apache DB Project
 
Font size:      

Verifying Startup

Verifying Startup

Derby provides the ability to ping the server.

You can use the scripts NetworkServerControl.bat or NetworkServerControl.ksh, with the ping command. For example:

NetworkServerControl ping [-h <host>;] 
[-p <portnumber>]

You can also use the NetworkServerControl command:

<java org.apache.derby.drda.NetworkServerControl ping [-h <host>] 
[-p <portnumber>] 

Verifying startup using the API

You can use the NetworkServerControl API to verify startup from within a Java application:

ping(); 

The following example uses a method to verify startup. It will try to verify for the specified number of seconds:

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;
    }

Previous Page
Next Page
Table of Contents
Index