# startMaster=true attribute

The startMaster=true attribute starts replication of a database in master mode.

Before you specify this attribute, you must cleanly shut down the database on the master system, perform a file system copy of the database to the slave system, and specify the startSlave=true attribute. For details, see the topic "Starting and running replication" under "Replicating databases" in the Derby Server and Administration Guide.

If the master database is already booted and any unlogged operations are running when the user specifies startMaster=true, the attempt to start the master fails and an error message appears.

For more information on replication, see the other topics under "Replicating databases" in the Derby Server and Administration Guide.

## Combining with other attributes

You must specify a database name in the connection URL, either in the subprotocol or by using the databaseName=nameofDatabase attribute.

You must specify this attribute in conjunction with the slaveHost=hostname attribute. You may also specify this attribute in conjunction with the slavePort=portValue attribute. If you do not specify the slavePort=portValue attribute, the default port value is 4851.

If authentication is turned on, you must also specify this attribute in conjunction with the user=userName and password=userPassword attributes. If both authentication and SQL authorization are turned on, the user must be the database owner.

You may not specify this attribute in conjunction with any attributes not mentioned in this section.

## Examples

    -- start master using database name in subprotocol, default slave
    --  port, authorization
    jdbc:derby:myDB;startMaster=true;slaveHost=elsewhere;user=mary;
       password=little88lamb

    -- start master using databaseName attribute, non-default slave
    --  port, no security
    jdbc:derby:;databaseName=myDB;startMaster=true;slaveHost=elsewhere;
       slavePort=4852

Parent topic: Setting attributes for the database connection URL