Using the NetworkServerControl API NetworkServerControl classNetworkServerControl APINetworkServerControl class and

You need to create an instance of the NetworkServerControl class if you are using the API. There are four constructors for this class:

Before enabling connections from other systems, ensure that you are running under a security manager.
NetworkServerControl()

This constructor creates an instance that listens either on the default port (1527) or the port that is set by the derby.drda.portNumber property. It will also listen on the host set by the derby.drda.host property or the loopback address if the property is not set. This is the default constructor; it does not allow remote connections. It is equivalent to calling NetworkServerControl(InetAddress.getByName("localhost"),1527) if no properties are set.

NetworkServerControl(InetAddress address, int portNumber)

This constructor creates an instance that listens on the specified portNumber on the specified address. The InetAddress will be passed to ServerSocket. NULL is an invalid address value. The following examples show how you might allow Network Server to accept connections from other hosts: //accepts connections from other hosts on an IPv4 system NetworkServerControl serverControl = new NetworkServerControl(InetAddress.getByName("0.0.0.0"),1527); //accepts connections from other hosts on an IPV6 system NetworkServerControl serverControl = new NetworkServerControl(InetAddress.getByName("::"),1527);

NetworkServerControl(String userName, String password)

If a network server should run with user authentication, certain operations like NetworkServerControl.shutdown() require that you provide user credentials. This constructor creates an instance with user credentials, which are then used for operations that require them. In all other aspects, this constructor behaves like NetworkServerControl().

NetworkServerControl(InetAddress address, int portNumber, String userName, String password)

This constructor creates an instance with user credentials, which are then used for operations that require them. In all other aspects, this constructor behaves like NetworkServerControl(InetAddress address, int portNumber).